WordPress.org

Ready to get started?Download WordPress

Forums

Only one item on front page (3 posts)

  1. ByteWarrior
    Member
    Posted 8 years ago #

    Hi,

    I'm designing a new theme for my website/weblog. I'm trying to figure out how I can put only one item on the front page.

    This is how it should work:
    * show excerpt from last article
    * show 5 latest titles
    * show 5 latest comments

    When clicking the article title, it should show only that article. I already know that works with single.php...

    Now it shows the last article ten times on the front page. I guess it has something to do with the placement of the loop.

    This is the index.php

    <?php get_header(); ?>

    <?php get_sidebar(); ?>

    <div id="content">

    <?php if (have_posts()) : ?>
    <?php while (have_posts()) : the_post(); ?>

    <?php $posts = get_posts('numberposts=1&offset=0'); foreach($posts as $post) :?>

    <div id="item">
    <h2 class="subject">" rel="bookmark" title="Permanente link naar <?php the_title(); ?>"><?php the_title(); ?></h2>
    <div class="date"><?php the_time('F jS, Y') ?></div>

    <div class="entry">
    <?php the_content("Lees verder »"); ?>
    </div>
    </div>
    <?php endforeach; ?>

    <div id="other">

    <div id="latestposts">
    <h3>Laaste artikels</h3>

      <?php $posts = get_posts('numberposts=5&offset=1'); foreach($posts as $post) : ?>

    • "><?php the_title(); ?>
    • <?php endforeach; ?>

    </div>

    <div id="latestcomments">
    <h3>Laatste reacties</h3>

      <?php get_recent_comments(); ?>

    </div>
    <div class="clear"></div>
    </div> <!-- Close other -->

    <?php endwhile; ?>
    <?php endif; ?>

    </div> <!-- Close content -->

    Can someone help me out here?
    Thanks in advance.

  2. moshu
    Member
    Posted 8 years ago #

    1. Please, post code to http://pastebin.com

    2. There is a lot of good reading about Multiple Loops:
    http://codex.wordpress.org/The_Loop#Multiple_Loops

  3. ByteWarrior
    Member
    Posted 8 years ago #

    1. Sorry for posting the code here.

    2. Thanks, I found the answer there. :-)

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.