• 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.

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Only one item on front page’ is closed to new replies.