开发者

WP Featured Image URI instead of Custom Field

开发者 https://www.devze.com 2023-02-26 06:48 出处:网络
I am in a situation with a theme where I can\'t rely on custom-fields in wordpress and need to use the \"featured image\" feature instead.

I am in a situation with a theme where I can't rely on custom-fields in wordpress and need to use the "featured image" feature instead.

This is the code that calls the custom field

<?php $thumbnail_image = get_post_meta($post->ID, 'post-image', true); ?>

I can't find any docu开发者_StackOverflowmentation on "featured image" in the Wordpress codex, but is it possible to call the url of the featured image of a page in this example?


This should get you going http://codex.wordpress.org/Function_Reference/get_the_post_thumbnail

Edit:

$image_attributes = wp_get_attachment_image_src( get_post_thumbnail_id() );
$image_src = $image_attributes[0];
0

精彩评论

暂无评论...
验证码 换一张
取 消