[resolved] Display Specific category and number of post (2 posts)

  1. Shovan
    Posted 3 years ago #


    Currently I have blogs page which pulls content from these category - blog, news and video.

    <?php $recent = new WP_Query(); ?>
    <?php $recent->query('cat=4,cat=15,cat=159'); ?>
    <?php while($recent->have_posts()) : $recent->the_post(); ?>
    	<div class="row <?php if ( $post->ID == $wp_query->post->ID ) { echo ' first-post yellow-higlight'; } else {} ?> blog-post">

    I would like to limit number of post shown on that page to 5.

    I believe the code I have written need to be modified or updated.

    Any suggestion would help

  2. Shovan
    Posted 3 years ago #

    I found it

     $catPost = query_posts( 'cat=4,15,159&posts_per_page=5' ); //change this
       foreach ($catPost as $post) : setup_postdata($post); ?>

Topic Closed

This topic has been closed to new replies.

About this Topic