Reputation: 2316
I am trying to echo a specific custom field named 'Price'.
I have tried
<?php echo get_post_meta($post->ID, 'Price', true); ?>
How can i echo the Price field?
Upvotes: 0
Views: 62
Reputation: 1007
Could be about, getting post ID.
echo get_post_meta(get_the_ID(), 'Price', true);
Also, you should use this inside loop.
Upvotes: 1
Reputation: 267
You will first have to get information about current post of Wordpress in a variable. For this you can use:
global $post;
This will get all post information in variable $post.
Than you can call your function and it should work:
echo get_post_meta($post->ID, 'Price', true);
But Price should be a meta property for that post.
Upvotes: 1
Reputation: 1900
Try echoing the post meta with this:
global $post;
echo get_post_meta($post->ID, 'Price', true);
Upvotes: 1