首页 WordPress函数 WordPress获取文章形式函数:get_post_format
正文 评论

WordPress获取文章形式函数:get_post_format

WordPress函数get_post_format用于获取文章的形式,在为不同形式的文章制作不同的模板时非常有用。

get_post_format( int $post = null )

函数参数

$post_id

整数型,默认值:null

文章的ID

函数返回值

  • aside 日志
  • chat 聊天
  • gallery 相册
  • link 链接
  • image 图像
  • quote 引语
  • status 状态
  • video 视频
  • audio 音频

标准形式的文章不会返回任何值。

函数使用示例

$format = get_post_format();get_template_part( \'format\', $format );

扩展阅读

get_post_format()函数位于:wp-includes/post-formats.php

相关函数:

  • set_post_format()
  • has_post_format()
  • get_post_format_link()
  • get_post_format_string()
  • the_post_format_audio()
  • get_the_post_format_media()
  • get_content_audio()
  • the_post_format_chat()
  • get_the_post_format_chat()
  • get_content_chat()
  • add_chat_detection_format()
  • the_post_format_gallery()
  • get_content_galleries()
  • get_post_gallery_images()
  • the_post_format_image()
  • get_the_post_format_image()
  • get_content_images()
  • the_post_format_quote()
  • get_the_post_format_quote()
  • get_content_quote()
  • the_post_format_url()
  • get_the_post_format_url()
  • get_content_url()
  • the_post_format_video()
  • get_content_video()
  • the_remaining_content()
  • get_the_remaining_content()
  • get_post_format_meta()
  • post_format_content_class()
  • get_post_format_content_class()
  • post_formats_compat()
-=||=-收藏赞 (0)
更多主题
v1.0.0
小程序收录免费WordPress主题:XCX主题
¥ 0 关注:22,483
详情
单栏极简文艺WordPress博客主题:Diaspora主题
¥ 0 关注:22,055
详情
简约黑白WordPress个人博客主题:Personal主题
¥ 0 关注:21,760
详情
功能丰富切轻量的WordPress虚拟资源主题:Rizhuti主题
¥ 599 关注:19,813
详情
v1.0.0
一款简约单栏的免费WordPress博客主题:itheme主题
¥ 0 关注:19,737
详情
v3.4.0
适用自媒体资讯的免费WordPress主题:Autumn主题
¥ 0 关注:16,836
详情
回复
暂无评论

不要再留垃圾评论了,主题君整理资源不容易,留几句鼓励的话吧。