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 …

WordPress获取下一页链接函数:get_next_posts_link

WordPress函数get_next_posts_link用于在归档页获取下一页链接,在制作归档页翻页导航时非常有用。 get_next_posts_link( string $label = null, int $max_page = 0 ) 函数参数$label 字符串值,默认值:n …

WordPress获取下一篇文章信息函数:get_next_post

WordPress函数get_next_post用于获取下一篇文章的信息,包括:文章内容、摘要、状态、标题、作者、发布时间等。 get_next_post( boolean $in_same_term = false, string $excluded_terms = '', string $taxonomy = 'category' ) 函数参数$in_same_ …

WordPress获取More标签分隔内容函数:get_extended

WordPress函数get_extended用于获取More标签分隔的内容,分别输出More标签前、后、中的内容,稍加变通就可以利用这个标签制作摘要输出、加密内容等。 get_extended( string $post_content ) 函数 …