get recent post problem
-
I am trying to make a recent post base on multiple categories but not all categories..
I have this code
<?php $args = array( 'numberposts' => '3', 'category' => '5'); $recent_posts = wp_get_recent_posts( $args, OBJECT ); foreach( $recent_posts as $recent ) : setup_postdata( $recent ); ?> <div id="search-post"> <h1><a href="<?php echo get_permalink() ?>"><?php the_title(); ?></a></h1> <p class="post-date">Posted on <span><?php the_time('F j, Y'); ?></span> at <span><?php the_time('g:i a'); ?></span></p> <br /> <div class="search-content"> <?php the_excerpt();?> </div> <a class ="search-read" href="<?php echo get_permalink() ?>">Read</a> <br /> </div> <br /><br /><br /> <?php endforeach; wp_reset_postdata();?>
problem is it results only the latest post regardless of categories and repeated it depending on numberposts.
what suppose to be the problem with my code?
I tried this
‘category’ => ‘5’ //no to avail
‘category’ => ‘3, 5’ //no to avail
‘category’ => ‘local, international’ //no to avail
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get recent post problem’ is closed to new replies.