• tylerz

    (@tylerz)


    My wordpress is installed in /blog and I have a landing page in the root that I want to display the latest post on (only 1 of).

    Here’s the code i’m using:

    <ul>
      	<?php require($_SERVER['DOCUMENT_ROOT'] . '/blog/wp-load.php'); query_posts('showposts=1');  if (have_posts()) : while (have_posts()) : the_post(); ?>
      	<li>
      		<h2><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h2>
     	 <?php the_excerpt(); ?>
      	</li>
      	<?php endwhile; else: echo "no posts"; endif; ?>
      	<?php wp_reset_query(); ?>
      </ul>

    showposts=1 doesn’t seem to be working correctly. I can’t seem to get this to display only 1 post. It’s currently showing me 6 posts with the code above. Am I missing something?

    Thanks for any help you can throw my way.

  • The topic ‘Display posts outside of the install directory.’ is closed to new replies.