Grow your CSS skills. Land your dream job.

Why is this showing more then 5 recent post

  • # September 23, 2011 at 12:33 pm

    I cannot get this to show only 5 post. It shows all the post listed in the category?




    Test



    < ?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>

    < ?php $my_query = new WP_Query('category_name=test-test&posts_per_page=5'); ?>


    < ?php wp_reset_query(); ?>

    < ?php endwhile; else: ?>

    < ?php _e('Sorry, no posts matched your criteria.'); ?>


    < ?php endif; ?>




    # September 23, 2011 at 12:39 pm

    Your query needs to go before the if/while statement.

    # September 23, 2011 at 1:01 pm

    Thanks. Its working now..

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

*May or may not contain any actual "CSS" or "Tricks".