Support » Plugins and Hacks » [Plugin: Custom Field Template] Custom fields show the same values for all my posts

  • Resolved krystiank

    (@krystiank)


    I set up a Custom field template for one category only.

    When I list all my posts with the Custom Fields, Custom fields show the same values for all my posts.

    What am I doing wrong?

    Here is my Loop:

    <?php query_posts($query_string . '&cat=24'); ?>
     <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
    
       	    <?php the_title(); ?>
    		Price: <?php echo $price; ?> | Apt. Size: <?php echo $apts; ?> | Location: <?php echo $loc; ?>
    		<?php the_content(); ?>
    <?php endwhile; ?>
     <?php endif; ?>

    Price, Apt size and Location are all the same for all my posts.

    http://wordpress.org/extend/plugins/custom-field-template/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Change:

    <?php echo $price; ?>

    to

    <?php echo get_post_meta($post->ID, 'price', true); ?>

    and a similar thing for the other two

    Thanks so much, it works now.

    I forgot to mention before that I used following to call my variables in echo

    <?php $apts = get_post_meta($post->ID, 'Apartment Size', true); ?>
    <?php $loc = get_post_meta($post->ID, 'Location', true); ?>
    <?php $price = get_post_meta($post->ID, 'Price', true); ?>

    But I took your advice and it works for me perfect.

    Thank so much for your help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: Custom Field Template] Custom fields show the same values for all my posts’ is closed to new replies.