Tagged: 

Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #99581
    ikh1
    Participant

    I’d like to change the meta display for posts on the front page so they all appear on one line, in the post footer, with nothing in the post header except the title.

    The format of the meta line should look like: [short date] categories, tags

    example:
    9/18/16 News, Conference

    (where News is a category and Conference is a tag)

    How can I accomplish this?

    #99600
    Mahesh
    Participant

    ikh1: For this, you’ll need to create a child theme. You can find more details on creating child theme HERE. Then in your child theme’s functions.php , add the following code:

    function adventurous_footer_meta() {
    
    	// Translators: used between list items, there is a space after the comma.
    	$categories_list = get_the_category_list( __( ', ', 'adventurous' ) );
    
    	// Translators: used between list items, there is a space after the comma.
    	$tag_list = get_the_tag_list( '', __( ', ', 'adventurous' ) );
    
    	$date = sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><time class="entry-date" datetime="%3$s">%4$s</time></a>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_attr( get_the_date( 'c' ) ),
    		esc_html( get_the_date( 'n/d/Y' ) )
    	);
    
    	// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
    	if ( $tag_list ) {
    		$utility_text = __( '<span class="on-date">%1$s</span> <span class="in-category">%2$s</span><span class="sep">, </span><span class="in-tag">%3$s</span>', 'adventurous' );
    	} elseif ( $categories_list ) {
    		$utility_text = __( '<span class="on-date">%1$s</span> <span class="in-category">%2$s</span>', 'adventurous' );
    	}
    
    	printf(
    		$utility_text,
    		$date,
    		$categories_list,
    		$tag_list
    	);
    }

    Then go to Dashboard=> Appearance=> Customize=> Theme Options=> Custom CSS box and add the following CSS:

    .entry-header .entry-meta {
        display: none;
    }

    Regards,
    Mahesh

    #99681
    ikh1
    Participant

    Your code worked perfectly! Thanks!

    #99722
    Mahesh
    Participant

    ikh1: Thank you for your appreciation. Have a nice day!

    Regards,
    Mahesh

Viewing 4 posts - 1 through 4 (of 4 total)
  • The topic ‘post meta item locations’ is closed to new replies.