WordPress添加水印插件Watermark Reloaded改进

WordPress插件Watermark Reloaded可以为上传的图片添加文字水印,但不支持中文,对于只需要在图片上添加网址水印的简单需求来说非常适合。 Watermark Reloaded插件支持 …

WordPress判断文章页面函数:is_single

WordPress函数is_single用于判断是否文章类型为post的页面,但不包括附件(attachments)和页面(page)。换句话说,is_single()函数判断当前 …

WordPress获取上一篇文章函数:get_previous_post

WordPress函数get_previous_post用于获取上一篇文章,可以限制返回相同分类的上一篇文章,需要用在文章页面模板里。 get_previous_post( boolean $in_same_cat, string $excluded_categories ) 函数参数$in_same_cat 布 …

WordPress获取删除文章链接函数:get_delete_post_link

WordPress函数get_delete_post_link获取删除文章的链接,访问获取到的这个链接将会把这篇文章移至回收站。该函数可以用于The Loop主循环或主循环之外。 get_delete_post_link( integer …

WordPress获取编辑文章链接函数:get_edit_post_link

WordPress函数get_edit_post_link用于获取文章的编辑链接,需要用户登录网站后台才能获取到编辑文章的链接,如果未登录状态则不返回任何内容。 get_edit_post_link( integer $id, string $context ) 函数参数 …

WordPress获取文章形式函数:get_post_format

WordPress函数get_post_format用于获取文章的形式,在为不同形式的文章制作不同的模板时非常有用。 get_post_format( int $post = null ) 函数参数$post_id 整数型,默认值:null 文章 …

WordPress获取文章状态函数:get_post_status

WordPress函数get_post_status用于获取文章的状态,比较少用到。 get_post_status( int $ID ) 函数参数$ID 整数型,默认为空 文章的ID 函数返回值 publish:公开的; pending …

WordPress获取附件MIME类型函数:get_post_mime_type

WordPress函数get_post_mime_type主要用于获取附件的MIME类型,当然也能返回文章、页面的MIME类型,但在实际应用中这并没有什么用处。 get_post_mime_type( int $ID ) 函数参数$I …

WordPress获取父页面ID函数:get_post_ancestors

WordPress函数get_post_ancestors用于获取父页面的ID,通常在企业模板中,侧边栏需要显示页面导航,例如:公司简介、企业文化、人才招聘等等,就可能需要用get …

WordPress获取文章数据函数:get_post

WordPress函数get_post用于获取文章的数据,包括文章内容、标题、别名、摘要、发布时间等信息。 get_post( int $post = null, string $output = OBJECT, string $filter = 'raw' ) 函数参数$post 整数型,默认值:null 文章 …