Add custom field to sidebar
-
I have read a lot about using global ID to display a custom field in a sidebar, but I’m having no luck.
I have a page setup to display 3 posts from a specific category:
<?php query_posts(“cat=$cat&showposts=3”); while ( have_posts() ) : the_post() ?>which is working just fine. After this line I have the following:
<?php global $wp_query; $postID = $wp_query->post->ID; ?>Then in the sidebar I have the following:
<?php
global $postID;
$key1 = get_post_meta($postID, ‘sidebar1’, true); if($key1) { echo “<p>$key1</p>”; }
?>But the custom field sidebar1 is not appearing. What am I doing wrong? Thank You
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Add custom field to sidebar’ is closed to new replies.