Stephen Way
Stephen Way

Reputation: 678

WP Featured Image URI instead of Custom Field

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 documentation 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?

Upvotes: 0

Views: 1193

Answers (1)

Unknown_Guy
Unknown_Guy

Reputation: 1026

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];

Upvotes: 2

Related Questions