问题描述
|
我遇到的主题是我不能依靠wordpress中的自定义字段,而需要使用\“特色图片\”功能。
这是调用自定义字段的代码
<?PHP $thumbnail_image = get_post_meta($post->ID,\'post-image\',true); ?>
我在wordpress代码库中找不到有关“特征图像”的任何文档,但是在此示例中是否可以调用页面特征图像的URL?
解决方法
这应该让你走
http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail
编辑:
$image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id() );
$image_src = $image_attributes[0];