Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End WordPress 3.1 Noob Question: Date Stamp Design

  • This topic is empty.
Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #32820
    hirok
    Member

    Hi All. I have a question about the designing the date stamps. Back in the day, I could edit the index.php file of the theme directory to design the date stamp by searching for the_time. I use Starkers naked WordPress theme. I read on another website that I could just replace timesince() ?> ago at with at .

    Can someone please teach me what file I need to edit and what piece of code I need to edit to design the date stamp?

    I thought the only files I need to really edit were the header.php, sidebar.php and footer.php. Anyway, Thank you in advance for your help. I really appreciate it

    #75597
    ccc630
    Member

    I believe you’re going to find that in the single.php file:

    	


    This entry was posted
    You'll need to download this plugin, and follow the instructions:
    http://binarybonsai.com/archives/2004/08/17/time-since-plugin/ */
    /* $entry_datetime = abs(strtotime($post->post_date) - (60*120)); echo time_since($entry_datetime); echo ' ago'; */ ?>
    on at
    and is filed under .

    Hope that helps. As an aside, if you start digging into other themes, you might find the date/time info in the meta.php file.

    #75606
    hirok
    Member

    This is fantastic. I will be trying this out and thank you so much ccc630!!!

    #75520
    ccc630
    Member

    Glad to help. It also occurred to me that you might want/need to add whatever time stamp verbage you settle on, to the Loop on the index page as well (if you’re keeping the loop on the index page, and if you want the same time stamp there. :)

    #75498
    hirok
    Member

    I did a search in the whole theme folder for

    ... and the search showed that there was no code for the_time in any of the files. That includes single.php and loop.php. This is what my single.php looks like and I'm at a loss.

    
    /**
    * The Template for displaying all single posts.
    *
    * @package WordPress
    * @subpackage Starkers
    * @since Starkers 3.0
    */

    get_header(); ?>











    '' . __( 'Pages:', 'twentyten' ), 'after' => '' ) ); ?>





    ">















    #75492
    ccc630
    Member

    hmmm….either I have an out-dated version of Starkers in my files (entirely possible) or…I don’t know. Can’t research right now, but will try to dig deeper tonight. First impulse is to look for the twentyten_posted_on function and edit that, but dunno.

    #75581
    TheDoc
    Member

    Your theme could also be using the_date();

    #75230
    jacorre
    Participant

    Might be in the functions.php file for your theme.

    #74619
    hirok
    Member

    Thank you. I looked in functions.php and found it. I was able to modify the date format. I used http://us.php.net/manual/en/function.date.php to figure out how I want my date formatted.

    I tried to design this section using div and css but they didn’t work. I thought I could split up the lines like:


    get_the_date('M')

    get_the_date('jS')

    get_the_date('Y')

    but it doesn’t work. Below is what the code currently looks like. So I’m trying to figure out how I can design this date stamp.

    Thanks again :)


    if ( ! function_exists( 'twentyten_posted_on' ) ) :
    /**
    * Prints HTML with meta information for the current post—date/time and author.
    *
    * @since Twenty Ten 1.0
    */
    function twentyten_posted_on() {
    printf( __( 'Posted on %2$s by %3$s', 'twentyten' ),
    'meta-prep meta-prep-author',
    sprintf( '',
    get_permalink(),
    esc_attr( get_the_time() ),
    get_the_date('M jS Y')
    ),
    sprintf( '%3$s',
    get_author_posts_url( get_the_author_meta( 'ID' ) ),
    sprintf( esc_attr__( 'View all posts by %s', 'twentyten' ), get_the_author() ),
    get_the_author()
    )
    );
    }

Viewing 9 posts - 1 through 9 (of 9 total)
  • The forum ‘Back End’ is closed to new topics and replies.