Title: Help with the Meta function (functions.php)
Last modified: September 1, 2016

---

# Help with the Meta function (functions.php)

 *  Resolved [markross67](https://wordpress.org/support/users/markross67/)
 * (@markross67)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/)
 * Hello,
    Below is my meta function from my Twenty Twelve (Child) Theme. I have
   it tweaked how I would like it to display my Post categories and Tags on the 
   Archive pages of my blog site.
 * Example:
    Posted in Opinion | Tagged Constitutional
 * I would, however, like to incorporate this bit of code:
 *     ```
       <?php if ( comments_open() ) : ?>
       				<div class="comments-link">
       					<?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
       				</div><!-- .comments-link -->
       			<?php endif; // comments_open() ?>
       ```
   
 * into the below code, if that is possible – so that the final result would appear
   like this:
 * Posted in Opinion | Tagged Constitutional | Leave a reply
 * Any help would be really appreciated!
 * Thank you,
    Marc
 *     ```
       /** Custom: Custom meta information */
   
       if ( ! function_exists( 'twentytwelve_entry_meta' ) ) :
       /**
        * Set up post entry meta.
        *
        * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
        *
        *
        * @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' ) );
   
       	$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() )
       	);
   
       	$author = sprintf( '<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', 'twentytwelve' ), get_the_author() ) ),
       		get_the_author()
       	);
   
       	// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
       	if ( $tag_list ) {
       		$utility_text = __( 'Posted in %1$s | Tagged %2$s <span class="by-author"></span>', 'twentytwelve' );
       	} elseif ( $categories_list ) {
       		$utility_text = __( 'Posted in %1$s <span class="by-author"></span>', 'twentytwelve' );
       	} else {
       		$utility_text = __( 'Posted in %1$s | Tagged %2$s <span class="by-author"></span>', 'twentytwelve' );
       	}
   
       	printf(
       		$utility_text,
       		$categories_list,
       		$tag_list,
       		$date,
       		$author
       	);
       }
       endif;
       ```
   

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482428)
 * Insert the comment link code just above the final curly brace } of the function
   and below the last `printf` closing parenthesis and semi-colon );
 * It needs slight modification like so:
 *     ```
       if ( comments_open() ) : ?>
          &nbsp;| <div class="comments-link">
             <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
          </div><!-- .comments-link -->
       <?php endif; // comments_open()
       ```
   
 * Any other discrepancy in appearance can likely be solved with CSS.
 *  Thread Starter [markross67](https://wordpress.org/support/users/markross67/)
 * (@markross67)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482466)
 * Hi bcworkz,
    Thank you so much for the reply!
 * The integration of the code worked just fine; however, the Leave a reply link
   is still showing up below the categories and tags:
 * Posted in Opinion | Tagged Constitutional |
    Leave a reply
 * I was hoping to have them all on the same line, as such:
 * Posted in Opinion | Tagged Constitutional | Leave a reply
 * Marc
 *  Thread Starter [markross67](https://wordpress.org/support/users/markross67/)
 * (@markross67)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482468)
 * And, here is the code, currently:
 *     ```
       /** Custom: Custom meta information */
   
       if ( ! function_exists( 'twentytwelve_entry_meta' ) ) :
       /**
        * Set up post entry meta.
        *
        * Prints HTML with meta information for current post: categories, tags, permalink, author, and date.
        *
        *
        * @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' ) );
   
       	$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() )
       	);
   
       	$author = sprintf( '<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', 'twentytwelve' ), get_the_author() ) ),
       		get_the_author()
       	);
   
       	// Translators: 1 is category, 2 is tag, 3 is the date and 4 is the author's name.
       	if ( $tag_list ) {
       		$utility_text = __( 'Posted in %1$s | Tagged %2$s <span class="by-author"></span>', 'twentytwelve' );
       	} elseif ( $categories_list ) {
       		$utility_text = __( 'Posted in %1$s <span class="by-author"></span>', 'twentytwelve' );
       	} else {
       		$utility_text = __( 'Posted in %1$s | Tagged %2$s <span class="by-author"></span>', 'twentytwelve' );
       	}
   
       	printf(
       		$utility_text,
       		$categories_list,
       		$tag_list,
       		$date,
       		$author
       	);
   
       if ( comments_open() ) : ?>
          &nbsp;| <div class="comments-link">
            <?php comments_popup_link( '<span class="leave-reply">' . __( 'Leave a reply', 'twentytwelve' ) . '</span>', __( '1 Reply', 'twentytwelve' ), __( '% Replies', 'twentytwelve' ) ); ?>
          </div><!-- .comments-link -->
       <?php endif; // comments_open()
   
       }
       endif;
       ```
   
 * I believe I did it exactly as you suggested. Please correct me if I am wrong.
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482479)
 * That’s correct. The line feed bit is likely because the CSS for the comment link
   defaults to it being treated as a block. (Assuming there is enough room for the
   comment link on the same line within the parent div)
 * As a wild guess, you could try `.comments-link { display: inline; }` added to
   your child’s style.css. Before fussing with uploading edited files, you might
   try experimenting with your browser’s CSS inspector tool to identify CSS that
   does what you want.
 * For anyone here to offer the correct CSS, we would need a live link to a page
   demonstrating the problem. We then use our browser’s inspector tool to figure
   out the correct CSS 😉
 *  Thread Starter [markross67](https://wordpress.org/support/users/markross67/)
 * (@markross67)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482490)
 * `.comments-link { display: inline; }`
 * That worked, perfectly, bc!!! Thank you soooooo much! 🙂
 * It is exactly how I wanted it now!
 *  Moderator [bcworkz](https://wordpress.org/support/users/bcworkz/)
 * (@bcworkz)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482516)
 * Hah! Lucky guess. I’m glad it all worked out.
 *  Thread Starter [markross67](https://wordpress.org/support/users/markross67/)
 * (@markross67)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482540)
 * More like an “educated guess”! 🙂
 *  Thread Starter [markross67](https://wordpress.org/support/users/markross67/)
 * (@markross67)
 * [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482541)
 * Thank you again! 🙂

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Help with the Meta function (functions.php)’ is closed to new replies.

 * In: [Hacks](https://wordpress.org/support/forum/plugins-and-hacks/hacks/)
 * 8 replies
 * 2 participants
 * Last reply from: [markross67](https://wordpress.org/support/users/markross67/)
 * Last activity: [9 years, 11 months ago](https://wordpress.org/support/topic/help-with-the-meta-function-functionsphp/#post-7482541)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
