Support » Fixing WordPress » custom fields display similar amounts

  • omidgs


    hello every one
    i use this method to display cutum field in my theme
    at the first add this lines to the firs of pages
    <?php $buy = get_post_meta($post->ID, ‘buy’, true); ?>
    <?php $gheymat = get_post_meta($post->ID, ‘gheymat’, true); ?>
    and next to disply values i insert this line
    <?php echo $buy; ?>
    <?php echo $gheymat; ?>
    in the single.php all things are good and working fine
    but in index.php and category.php all amounts are similar
    for example if good 1 is 200$ and good 2 is 100$ all goods buy show 100$
    (the newest amount
    whats problem?
    please help

    the page code

    <?php $buy = get_post_meta($post->ID, 'buy', true); ?>
    <?php $gheymat = get_post_meta($post->ID, 'gheymat', true); ?>
    <div class="container">
    	 <div class="posttitle">
        <ul class="jDesign_tabs">
    	<div class="shop"></div>
            <li><a href="#tab2" title="برای دیدن محصولات فروشگاه کلیک کنید">تازه های فروشگاه</a></li>
            <div id="tab2" class="jD_content">
              	<?php if (have_posts()) : ?>
            <?php while (have_posts()) : the_post(); ?>
    			<div class="shopbg">
                <a href="<?php the_permalink() ?>" rel="bookmark"></a>
            <a href="<?php the_permalink() ?>"><h2 class="stitle"><?php the_title(); ?></h2></a><p class="gh"><?php echo $gheymat; ?></p>
            <a href="<?php the_permalink() ?>" rel="bookmark">
    </a><a href="<?php the_permalink() ?>"><div class="sthumb"><?php the_post_thumbnail( array(150,150) ); ?></div></a>
    					<a class="buya" href="<?php echo $buy; ?>"><div class="buy"></div>خرید پستی</a>
                        <a class="buya" href="<?php the_permalink() ?>" rel="bookmark"><div class="smore"></div>توضیحات
           <?php endwhile; ?>
    <?php else : ?>
     <?php _e('Not Found'); ?>
    ?php _e('Sorry, no posts matched your criteria.'); ?>
       <?php endif; ?>
        <div class="sp2"></div>
         <div class="pages"><?php
    ?>	</div>

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘custom fields display similar amounts’ is closed to new replies.