I’m using WordPress as a CMS and have the following setup:
– home.php in root
– WordPress installed in ./wordpress/
<?php if (have_posts()) : ?>
<?php query_posts('showposts=1'); ?> //I only want to show the latest post on my homepage
<?php while (have_posts()) : the_post(); ?>
<?php the_title(); ?>
<?php the_content('Read the rest »'); ?>
<?php endwhile; ?>
<?php endif; ?>
Everything works fine with Permalinks set to standard.
However when using any other setting for Permalinks (I want to use /%category%/%postname%/) the post doesn’t show. It turns out this is because have_posts() returns false. If I remove <?php if have_posts()) : ?> altogether, then the post does show – entirely. That is to say, the_content() does not work in this case, since the article has a MORE tag at some point.
In case you’re wondering, mod_rewrite is enabled. Also, when I access the blog itself (./wordpress/index.php) everything works just fine.
So, does anyone have any idea why have_posts() should return false when using any other permalinks other than the standard ones?