WordPress获取文章形式函数:get_post_format
文 / @WordPress主题
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()

相关文章
-
搭建一个WordPress网站需要多少成本 2023-11-06 00:09:51
-
Symlink介绍(附:如何使用Symlink进行WordPress开发) 2023-11-05 23:38:32
-
让WordPress实现数据库同步的插件:HyperDB 2023-10-24 23:40:49
-
allegro电商平台值得做吗(附:2023年Allegro注册流程指南) 2023-10-08 21:53:39
-
印度跨境电商平台有哪些(附:印度跨境电商做什么产品好) 2023-10-08 21:34:23
-
跨境电商必看的几大海外二手电商平台 2023-10-08 18:04:42
-
WordPress同城互联网产品解决方案:UBASE 2023-10-03 16:40:39
-
WordPress网站的安全插件:wordfence 2023-09-14 09:25:18
-
WordPress 6.3 支持在手动更新插件和主题失败后回滚旧版本 2023-08-28 16:58:45
-
WordPress 6.3版本(2023年8月)性能提升了哪些? 2023-08-28 16:56:02