Forums

How to show who posted and when they posted on recent posts? (2 posts)

  1. brianjw
    Member
    Posted 3 years ago #

    Hi,

    I am using a modified recent posts that I modified to work with a template. Here it is: http://www.new.gamerzgarage.com/

    Now, if you go here: http://www.gamerzgarage.com/
    You'll see the same thing in the same area called "RECENT FORUM TOPICS" That shows who posted and what date it was posted.

    How could I do this with recent posts? Just provide me with the code and tell me what is for what and I can code it. If you could tell me how I could make something so if the date is today then it will show the date as Today but then show the time and same thing for yesterday.

    Thanks,
    Brian

  2. MichaelH
    Volunteer
    Posted 3 years ago #

    This should work in a valid post loop:

    <?php $post_date = mysql2date("Ymd", $post->post_date_gmt); ?>
    <?php if ( $post_date==date('Ymd') )
    { ?>
    By <?php the_author(); ?> Today
    <?php } else { ?>
    By <?php the_author(); ?> <?php the_time('F j, Y'); ?>, <?php the_time('g:i a'); ?>
    <?php
    }
    ?>

    Resources:
    Template_Tags/the_time
    Template_Tags/the_author

Topic Closed

This topic has been closed to new replies.

About this Topic