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 文章 …

WordPress获取文章缩略图函数:get_the_post_thumbnail

WordPress函数get_the_post_thumbnail用于获取文章的缩略图,该函数会直接返回带有img标签的缩略图。 get_the_post_thumbnail( int $post = null, string|array $size = 'post-thumbnail', string|array $attr = '' ) 函数参数$post 整数型 …

WordPress获取文章摘要函数:get_the_excerpt

WordPress函数get_the_excerpt用于获取文章的摘要,通常用在归档页输出文章列表时同时输出文章的摘要,文章页面也可以将摘要作为导读输出,更有用的是将摘要内容作为D …