• Resolved velanche

    (@velanche)


    Hi There:
    I have a modified child theme of the parent Twenty Thirteen parent, located at velanche.com.

    If you click on the “Blog” header link, you can find my posts. I don’t like the entry meta, and wish to make changes to it.

    I’d like for it to be something like “Posted by Velanche on November 26, 2013 at 8:10pm.” I don’t need the categories, nor do I need the icons that are next to the entry date and author name.

    I searched quite a bit online for info on this, and I even tried working with the Chrome developer tools and found “entry-meta” in the content.php file (child theme), but I don’t see any suitable info to edit/dump the author, date, clock and categories info.

    Thanks for reading; could use the help!

    Best,
    Velanche

Viewing 5 replies - 1 through 5 (of 5 total)
  • in functions.php of the child theme, add a new version of the function twentythirteen_entry_meta():

    (unedited version from Twenty Thirteen below)

    function twentythirteen_entry_meta() {
    	if ( is_sticky() && is_home() && ! is_paged() )
    		echo '<span class="featured-post">' . __( 'Sticky', 'twentythirteen' ) . '</span>';
    
    	if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )
    		twentythirteen_entry_date();
    
    	// Translators: used between list items, there is a space after the comma.
    	$categories_list = get_the_category_list( __( ', ', 'twentythirteen' ) );
    	if ( $categories_list ) {
    		echo '<span class="categories-links">' . $categories_list . '</span>';
    	}
    
    	// Translators: used between list items, there is a space after the comma.
    	$tag_list = get_the_tag_list( '', __( ', ', 'twentythirteen' ) );
    	if ( $tag_list ) {
    		echo '<span class="tags-links">' . $tag_list . '</span>';
    	}
    
    	// Post author
    	if ( 'post' == get_post_type() ) {
    		printf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>',
    			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    			esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),
    			get_the_author()
    		);
    	}
    }
    Thread Starter velanche

    (@velanche)

    Hey alchymyth:
    Thanks a lot for that! I copied the code into functions.php within my child theme, then took out categories and swapped things around so that my name and the date would appear in order. So far, it works great.

    The only thing I’m having trouble with now is to try and add text to make it like “Posted by <author> on <date>. I tried several variations of using the PHP echo command to add “Posted by ” and “on ” in, but the page ends up blank each time.

    I tried the convention:

    `<?php echo ‘text ‘ ; ?>’

    That didn’t work for me.

    What say you?
    V.

    try:

    function twentythirteen_entry_meta() {
    	if ( is_sticky() && is_home() && ! is_paged() )
    		echo '<span class="featured-post">' . __( 'Sticky', 'twentythirteen' ) . '</span>';
    
    	if ( ! has_post_format( 'link' ) && 'post' == get_post_type() )
    		{
    		if ( has_post_format( array( 'chat', 'status' ) ) )
    		$format_prefix = _x( '%1$s on %2$s', '1: post format name. 2: date', 'twentythirteen' );
    		else
    		$format_prefix = '%2$s';
    
    		$date = sprintf( ' on <span class="date"><a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a> at <a href="%1$s" title="%2$s" rel="bookmark">%5$s</a></span>',
    		esc_url( get_permalink() ),
    		esc_attr( sprintf( __( 'Permalink to %s', 'twentythirteen' ), the_title_attribute( 'echo=0' ) ) ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_date() ) ),
    		esc_html( sprintf( $format_prefix, get_post_format_string( get_post_format() ), get_the_time() ) )
    		);
    		}
    	// Post author
    	//  "Posted by Velanche on November 26, 2013 at 8:10pm."
    	if ( 'post' == get_post_type() ) {
    		printf( 'Posted by <span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s" rel="author">%3$s</a></span>%4$s',
    			esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
    			esc_attr( sprintf( __( 'View all posts by %s', 'twentythirteen' ), get_the_author() ) ),
    			get_the_author(),
    			$date
    		);
    	}
    }

    to get rid of the icons, add this to the styles:

    .entry-meta .date a:before { content: ""; }
    .entry-meta .author a:before { content: ""; }
    .entry-meta > span { margin-right: 3px; }

    Thread Starter velanche

    (@velanche)

    Hey thanks for that! I will play around with it and find out if I need it.

    I actually, for now, have just took out all but the post date, and that might be sufficient since I’m the only author. I will return to this and find out if it fits, but I do appreciate your taking the time to solve this for me.

    Thanks much”!
    V.

    Hey alchymyth—

    I am trying to do something very similar to Velanche. This code seems to be working perfectly except it makes my categories disappear. Is there a simple tweak to keep this formatting (Posted by (Author) on (Date) at (Time) and then display categories on a second line in the entry-meta section?

    Edit: Not sure if this is possible, but what I’d really like to do styling-wise is put the categories or tags ABOVE the entry header styled in all caps. So ideally what it would be look like is:

    CATEGORY 1, CATEGORY 2, CATEGORY 3
    Post Title
    By (author) on (date) (time)

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Edit Entry Meta Information’ is closed to new replies.