是否有一个函数来获取wordpress中的图像标题 [英] Is there a function to get the caption for an image in wordpress

查看:138
本文介绍了是否有一个函数来获取wordpress中的图像标题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正试图从Wordpress中的图像中获取字幕,但我找不到一个简单的功能来获取这些信息。

I'm trying to get the captions from images in Wordpress but I can't find an easy function to grab this bit of information.

任何人都知道一种方式得到这个?

Anyone know a way to get this?

谢谢

推荐答案

结果标题存储作为后摘录。那么,

Turns out captions are stored as post excerpts. So,

<?php echo $post->post_excerpt; ?>

如果您在附件图片页面(主题中的image.php),将打印出标题在循环中。

will print out the caption if you are on the attachment image page (image.php in your theme) and inside the Loop.

这篇关于是否有一个函数来获取wordpress中的图像标题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆