Limit number of posts on home page to one (the latest)
-
I apologize for rehashing this as I thought I found a resolution in this forum entry.
I would like to reopen this discussion for the same purposes as originally intended. I have a programming background, so I thought I could grasp the PHP modifications recommended toward the end of the thread.
I can see how the entries noted did not work, as the continuation terminator “?>” was excluded from each one (except the example where placed directly within the same PHP segment as the “if (have_posts…”). However, I believe I am inserting this code correctly into the proper index.php file, and it is still not limiting the number of posts on the home page?? (I prefer not to use a plugin for what seems to be a simple solution which I am obviously not be applying correctly.)
I am using WordPress 2.6.3 with the default theme. I found The Loop in the file /wp-content/themes/default/index.php. It is broken up into two PHP segments as follows:
<?php if (have_posts()) : ?> <?php while (have_posts()) : the_post(); ?>
I inserted the following segment directly above the top entry:
<!-- Limit the home page to display only one (the latest) post --> <?php if(is_page('home') && !is_paged()) { query_posts($query_string.'limit=1'); } ?>
However, this is not limiting the number of blog posts to one as was previously stated in the original thread. Could someone please identify where I may be inserting this code incorrectly?
Thank you in advance for your assistance.
Wynne
- The topic ‘Limit number of posts on home page to one (the latest)’ is closed to new replies.