wordpress - get_post_meta don't work in my wp template -
<?php $promo_icon = get_post_meta($post->id, 'promo_icon', true);?> <?php global $post; $args=array( 'posts_per_page'=> 4, 'post_type'=>'promo'); $myposts=get_posts($args); foreach($myposts $post): setup_postdata($post);?> <li> <a href="#"> <span class="ca-icon"> <?php echo $promo_icon; ?> </span> <div class="ca-content"> <h2 class="ca-main"><?php the_title(); ?></h2> <h3 class="ca-sub"><?php the_content(); ?></h3> </div> </a> </li> <?php endforeach; ?> at first register custom post in functions.php file. name promo...then used code in index.php , used value in custom field....but the_title , the_content working , get_post_meta not working..
Comments
Post a Comment