QQ咨询不加好友发不了信息,咨询前先加好友! → QQ:820896380

WordPress获取文章形式函数:get_post_format

WordPress函数get_post_format用于获取文章的形式,在为不同形式的文章制作不同的模板时非常有用。get_post_format( int $post = null )函数参数$post_id整数型,默认值:null文章的ID函数返回值aside 日志chat 聊天gallery 相册link 链接i...

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

get_post_format( int $post = null )

函数参数

$post_id

整数型,默认值:null

文章的ID

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

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

get_post_format()函数使用示例

$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()

声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。

给TA打赏
共{{data.count}}人
人已打赏
豆包可以帮你高效完成AI问答、AI对话、提供软件相关教程以及解决生活中遇到的各种疑难杂症,还能帮助你进行AI写作、AI绘画等等,提高你的工作学习效率。
!
你也想出现在这里?立即 联系我们吧!
信息
个人中心
购物车
优惠劵
今日签到
搜索