ThemeShaper Forums » Thematic


get_post_meta does not output

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

    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);
    		<div class="entry-content">
    <?php thematic_content(); ?>
    		<?php thematic_postfooter(); ?>
    	</div><!-- .post -->
    <?php endwhile;
    Posted 11 years ago #
  2. Lasson

    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 11 years ago #
  3. @lasson thanks for taking the time to post your solution.

    Posted 10 years ago #
  4. you could probably also

    global $post;

    inside the function and the original method would work

    Posted 10 years ago #

RSS feed for this topic

Topic Closed

This topic has been closed to new replies.