WordPress.org

Ready to get started?Download WordPress

Forums

Last posts per day script ajustment (5 posts)

  1. sequence
    Member
    Posted 7 years ago #

    I have found the following script which shows me the last 10 posts.
    I'm trying to get the day ("the_time('l')") above the articles of each day in stead of in front of every separate line.

    So for example:
    Friday
    Article 7
    Article 6
    Article 5
    Thursday
    Article 4
    Article 3
    Wednesday
    Article 2
    Article 1

    How do I need to change the code to do that?

    <h2><?php _e('Last 10 Posts'); ?></h2>
    <?php
    query_posts('showposts=10');
    ?>
    <table>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <tr>
    <td>[<?php the_time('l') ?>]</td><td><?php the_time('H:i') ?></td><td>"><?php the_title() ?> </td>
    </tr>
    <?php endwhile; endif; ?>
    </table>

  2. Chris_K
    Member
    Posted 7 years ago #

    Ugh. tables. Well, something like this maybe?

    <h2><?php _e('Last 10 Posts'); ?></h2>
    <?php
    query_posts('showposts=10');
    ?>
    <table>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <tr>
    <td>[<?php the_time('l') ?>]</td><td><?php the_time('H:i') ?></td>
    </tr><tr>
    <td colspan="2"><?php the_title() ?> </td>
    </tr>
    <?php endwhile; endif; ?>
    </table>

  3. sequence
    Member
    Posted 7 years ago #

    this results in just having the day above _each_ line.

    right now i'm using this code:

    ##################
    <h2><?php _e('Last 10 Posts'); ?></h2>
    <?php query_posts('showposts=10'); ?>
    <table>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <tr><td>[<?php the_time('d-m') ?>]</td><td><?php the_time('H:i') ?></td><td><?php the_title() ?></td></tr>
    <?php endwhile; endif; ?>
    </table>
    ##################

    This results in the following output:

    ##################
    Last 10 Posts

    [04-06] 12:27 Article 10
    [03-06] 13:09 Article 9
    [03-06] 12:05 Article 8
    [03-06] 09:40 Article 7
    [02-06] 18:56 Article 6
    [02-06] 17:56 Article 5
    [02-06] 17:34 Article 4
    [02-06] 15:52 Article 3
    [02-06] 11:09 Article 2
    [02-06] 10:51 Article 1
    ##################

    But I want it to look like this:
    ##################
    Last 10 Posts

    Sunday
    12:27 Article 10
    Saturday
    13:09 Article 9
    12:05 Article 8
    09:40 Article 7
    Friday
    18:56 Article 6
    17:56 Article 5
    17:34 Article 4
    15:52 Article 3
    11:09 Article 2
    10:51 Article 1
    ##################

    Tnx in advance!

  4. sequence
    Member
    Posted 7 years ago #

    anybody?

  5. sequence
    Member
    Posted 7 years ago #

    would realy be helped if anybody could help me ajusting the code.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags