I have issues with query_post for limiting the post on the homepage. I only want 1 post on the homepage, and I know you would normally use the is_home() conditional tag, but right now I’m just wanting to get this to work, I can do that part later.
I have looked all over the forums, and have not been able to find something that actually worked. If I run this code, and in the options for reading I have the “At most show” value of 10, so that when someone searches or clicks on a tag, they will get 10 posts per page, but on the homepage (when I use the is_home() conditional) it will only show the current post. Of course, this is not working whatsoever, it is just using the value in the Reading Options (current value of 10).
`<?php query_posts(‘showposts=1’); ?>
<?php if ( $posts ) : foreach ( $posts as $post ) : start_wp(); ?>
<h2>” title=”Permalink: <?php the_title(); ?>”><?php the_title(); ?></h2>
<?php the_content(“Continue reading ” . the_title(”, ”, false)); ?>
<?php post_updated(‘M j, Y’, 24, ‘<p class=”updated”>Updated: ‘, ‘</p>’); ?>
</div> <!– close post –>`
If someone could help me out, that would be great! Thanks in advanced.
- The topic ‘query_post (single post on homepage) not working’ is closed to new replies.