WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Index entries laid out differently (4 posts)

  1. fembat
    Member
    Posted 7 years ago #

    I used to have some code that allowed me to have entries on the index page displayed differently - it was a very specific code I used to create a news wordpress theme but I have now lost it.

    The first one drew the most recent entry and allow me to display it like a feature.

    The second piece of code drew the next three or so number of articles and displayed them underneath - it had a special little feature which basically said display three entries starting at the second most recent post.

    Have looked everywhere but cant find something similar. Can anyone help?

  2. fembat
    Member
    Posted 7 years ago #

    OK. By searching the forums I managed to find this, which outlines what I want. Anyone got any ideas how I can do it.

    Basically I used the post-teaser plugin to only show the first 100 characters of a post and restricted the homepage to display 1 post at a time. The normal loop was in a div called latestpost

    I then found in the Wikki the useful get_posts template tag - so I then created another div called recentposts and used the get_posts function to return the title and excerpt from the most recent 3 posts (using an offset of 1 to miss the latest post).

  3. fembat
    Member
    Posted 7 years ago #

    Still working on this... but going wrong somewhere.

    Can anyone tell me where I have gone wrong here

    <?php
    $myposts = get_posts('numberposts=1');
    foreach($lastposts as $post) :
    setup_postdata($post);
    ?>
    <div class="topNewsDate">Top News - <?php the_date('','<h2>','</h2>'); ?></div>

    <div class="newsOne">
    <h2>" rel="bookmark"><?php the_title(); ?></h2>
    <?php the_content(__('(more...)')); ?>
    <?php wp_link_pages(); ?>
    <?php comments_popup_link(__('Comments (0)'), __('Comments (1)'), __('Comments (%)')); ?>
    <?php comments_template(); // Get wp-comments.php template ?>
    <?php endforeach; ?>
    </div>

    <div class="newsTwo">
    <?php
    $myposts = get_posts('numberposts=1&offset=1');
    foreach($lastposts as $post) :
    setup_postdata($post);
    ?>
    " id="post-<?php the_ID(); ?>"><?php the_title(); ?>
    <?php the_content(); ?>
    <?php endforeach; ?>

  4. fembat
    Member
    Posted 7 years ago #

    Still struggling :-(

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.