WordPress.org

Support

Support » Plugins and Hacks » Hacks » [Resolved] Display Specific category and number of post

[Resolved] Display Specific category and number of post

  • Shovan
    Member

    @thescube

    Hi,

    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

Viewing 1 replies (of 1 total)
  • Shovan
    Member

    @thescube

    I found it

    <?php
     $catPost = query_posts( 'cat=4,15,159&posts_per_page=5' ); //change this
       foreach ($catPost as $post) : setup_postdata($post); ?>
Viewing 1 replies (of 1 total)
  • The topic ‘[Resolved] Display Specific category and number of post’ is closed to new replies.