WordPress.org

Ready to get started?Download WordPress

Forums

[closed] TwentyTwelve - move entry meta date to top of post (6 posts)

  1. dragonsjaw
    Member
    Posted 1 year ago #

    How do I pick apart the meta info in Twenty Twelve?
    I have found it in functions.php but have little idea how to change it.

    I have added this to child functions.php:

    if ( ! function_exists( 'twentytwelve_entry_meta_top' ) ) :
    
    function twentytwelve_entry_meta_top() {
    
    $date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s" pubdate>%4$s</time></a>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date() )
    	);
    }
    endif;

    And I have added this (crude yes) to just below the final header tag in content.php. I have also added the css class.

    <footer class="entry-meta-top">
    <?php twentytwelve_entry_meta_top(); ?>
    </footer>

    Nothing happens, no errors, but no date at the top either.

    I have figured out here how to move the whole line above the content, but that isn't really what I would like to do.

    I want the TITLE of post and then the DATE one line below and to the the right.
    And I want the posted in, tagged, and edit below the content. (where it already is)

    Any help will be appreciated. Thanks.

  2. dragonsjaw
    Member
    Posted 1 year ago #

    Ok I removed the date stamp from the entry meta in functions on a child theme, and I added the date stamp (without a link) (permalink) to just under the title to the right by adding as styled div to content.php with a call for the date.

  3. marczr
    Member
    Posted 1 year ago #

    This is exactly what I'd like to do, any chance you could be a bit more detailed in how you achived it?

    Thanks

  4. dragonsjaw
    Member
    Posted 1 year ago #

    Ok, in content.php in your child theme find this section in the header area:

    <header class="entry-header">
    			<?php the_post_thumbnail(); ?>
    			<?php if ( is_single() ) : ?>
    			<h1 class="entry-title"><?php the_title(); ?></h1>
    <div class="title-date"><?php the_time('l - j F Y') ?></div>
    			<?php else : ?>
    			<h1 class="entry-title">

    See the line:
    <div class="title-date"><?php the_time('l - j F Y') ?></div>

    That is a styled div to give me the time stamp to the right of the title, one line below.

    And this is what I have in child theme in functions for enty meta:

    if ( ! function_exists( 'twentytwelve_entry_meta' ) ) :
    /**
     * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
     *
     * Create your own twentytwelve_entry_meta() to override in a child theme.
     *
     * @since Twenty Twelve 1.0
     */
    function twentytwelve_entry_meta() {
    	// Translators: used between list items, there is a space after the comma.
    	$categories_list = get_the_category_list( __( ', ', 'twentytwelve' ) );
    
    	// Translators: used between list items, there is a space after the comma.
    	$tag_list = get_the_tag_list( '', __( ', ', 'twentytwelve' ) );
    
    	// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
    	if ( $tag_list ) {
    		$utility_text = __( 'This entry was posted in %1$s and tagged %2$s. || ', 'twentytwelve' );
    	} elseif ( $categories_list ) {
    		$utility_text = __( 'This entry was posted in %1$s. || ', 'twentytwelve' );
    	} 
    
    	printf(
    		$utility_text,
    		$categories_list,
    		$tag_list,
    		$date,
    		$author
    	);
    }
    endif;

    Now you need to be careful here, as I did what I needed for my blog, you may want different.
    Sorry to post back so late, lost sight of this one.

  5. tito555
    Member
    Posted 1 year ago #

    How do you do this in a child theme (using twenty twelve)?

  6. Andrew
    Forum Moderator
    Posted 1 year ago #

    You can ask this on your own thread.

Topic Closed

This topic has been closed to new replies.

About this Topic