• Resolved particlepat

    (@particlepat)


    I’m having some issues writing the loop for my wordpress site. There will be a static homepage that will contain the header, footer, top navigation bar, a containing holding some navigation buttons that will only be visible on the home page, and then a smaller container to the right of that one that will hold a small snippet/excerpt of my most recent blog post.

    I am starting to get really frustrated when I try to write the loop for the single blog post. I want to show the blog title that links to the post, the authors name, the excerpt, a link that says “Read the rest of this entry”, the number of comments, and a link to leave a comment. I do not want a list of comments to appear on the homepage though.

    I have been able to get the title, the authors name and an excerpt of the blog, but it shows an excerpt for all of my entries, and like I said, I only want one. Can someone please give me some pointers or help me write the code for my loop?

    *I will have a separate page designated to showing all blog posts, so I’m assuming that will be a completely different loop. I’m only focused on the first loop as of now.

Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    What’s the code for your loop right now? Should be a simple matter of adding a query_posts call to adjust the parameters of the main query.

    Thread Starter particlepat

    (@particlepat)

    <?php if (have_posts()) : ?>
    		<?php while (have_posts()) : the_post(); ?>
    
    			<div class="post">
    				<h1 class="toptitle"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h1>
    				<p class="topMeta">by <?php the_author_firstname(); ?> <?php the_author_lastname(); ?></p>
    
    			<div class="entry">
    				<?php the_excerpt(); ?>
    			</div>
    
    			</div> <!-- Closes post --><br />
    
    	<?php endwhile; ?>
    
    	<?php endif; ?>
    Moderator Samuel Wood (Otto)

    (@otto42)

    www.remarpro.com Admin

    Okay. Add query_posts('showposts=1'); right before that Loop.

    Thread Starter particlepat

    (@particlepat)

    Thank you very much, I knew it was something incredibly easy like that. You’re the man.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘The Loop: posting only the most recent post to a static homepage’ is closed to new replies.