ThemeShaper Forums » Thematic

[closed]

get_post_meta does not output

(4 posts)
  • Started 9 years ago by Lasson
  • Latest reply from helgatheviking
  • This topic is resolved
  1. Lasson
    Member

    troublesome get_post_meta

    This function works fine, except that the meta value I am trying to get out doesn't show up. What am I doing wrong? Can some one help me see it? I have also tried defining variable $key as 'dd_no' and put that in. And tried with " instead of '.

    function recent_pub(){
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts('category_name=publications&showposts=3&paged=' . $paged);
    while (have_posts()) : the_post(); ?>
    	<div id="belowlist" class="hentry">
    		<?php echo get_post_meta($post->ID, 'dd_no', true);
    		thematic_postheader();?>
    		<div class="entry-content">
    <?php thematic_content(); ?>
    
    		</div>
    		<?php thematic_postfooter(); ?>
    	</div><!-- .post -->
    <?php endwhile;
    thematic_navigation_below();
    wp_reset_query();
    }
    Posted 9 years ago #
  2. Lasson
    Member

    ok found it... learning curve is getting better I think. Have been coding php for three days now :).

    since its inside the loop I should call "get_post_meta(get_the_id(), 'dd_no', true)" instead of "get_post_meta($post->ID, 'dd_no', true)"

    Posted 9 years ago #
  3. @lasson thanks for taking the time to post your solution.

    Posted 8 years ago #
  4. you could probably also

    global $post;

    inside the function and the original method would work

    Posted 8 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.