Tuesday, September 16, 2014

How to limit the no of posts in wordpress?

The below code would help you to limit the no of posts:-

<?php
$page_num = $paged;
if ($pagenum='') $pagenum =1;
query_posts('showposts=4&paged='.$page_num); ?>
<?php if ( have_posts() ) : ?>

            <?php /* Start the Loop */ ?>
            <?php while ( have_posts() ) : the_post(); ?>
               
                <?php //the_title();
                ?><div id="read">
                <?php the_content();//get_template_part( 'content', get_post_format() ); ?>
            </div><?php endwhile; ?>

            <?php //twentytwelve_content_nav( 'nav-below' ); ?>

        <?php endif; ?>

No comments:

Post a Comment