WordPress.org

Ready to get started?Download WordPress

Forums

TwentyTen: Separate Date from Author in twentyten_posted_on function (1 post)

  1. IceyD
    Member
    Posted 5 months ago #

    Hello!

    My blog's URL is: http://www.iceybooks.com/blog
    Ideally, I would like to extract the entry-date from the entry-meta (which houses the date and posted-by), but I'm not sure how to do that.

    In loop.php, I have this:
    <div class="entry-meta">
    <?php twentyten_posted_on(); ?>
    </div><!-- .entry-meta -->

    In functions.php, I have this:
    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( __( '%2$s <span class="posted-by">Posted by %3$s</span>', 'twentyten' ),
    'meta-prep meta-prep-author',
    sprintf( '<span class="entry-date">%3$s</span>',
    get_permalink(),
    esc_attr( get_the_time() ),
    '<time class="month">' . get_the_date('M') . '</time>
    <time class="day">' . get_the_date('d') . '</time>
    <time class="year">' . get_the_date('Y') . '</time>'
    ),

    sprintf( '<span class="author vcard">%3$s</span>',
    get_author_posts_url( get_the_author_meta( 'ID' ) ),
    esc_attr( sprintf( __( 'View all posts by %s', 'twentyten' ), get_the_author() ) ),
    get_the_author()
    )
    );
    }

    endif;

    What I'd like to do, is extract the date from this and give it it's own function, so I can close it in a <div> and move it into the posthead.

    Any idea how to do this? Thank you in advance!

Reply

You must log in to post.

About this Topic