WordPress.org

Ready to get started?Download WordPress

Forums

Responsive
Modify post-meta output? (8 posts)

  1. bobschwenkler
    Member
    Posted 9 months ago #

    I'd like to change the formatting/wording of the post meta. Where's the php file that generates the post meta?

  2. byankov
    Member
    Posted 9 months ago #

    You'd better not change the php files if you don't know what you do.
    You can set a custom post meta for every post and also custom post meta format using this plugin: http://wordpress.org/plugins/all-in-one-seo-pack/

  3. bobschwenkler
    Member
    Posted 8 months ago #

    Are we talking about the same thing? I'm just talking about changing the formatting of the date, author, etc, in WP when you're looking at a blog post.

  4. satankoh666
    Member
    Posted 8 months ago #

    I also changed that for Page. As I see no reason for page to show when was the page create and by who.

    Anyway, for page, you can change it in post-meta-page.php

  5. ggarmento
    Member
    Posted 8 months ago #

    create separate functions.php in child theme (child theme functions.php is read before the parent functions.php file; as opposed to child theme CSS file is read after parent CSS file.)

    place responsive_post_meta_data code below in new child theme functions.php file.

    modify the function "responsive_post_meta_data" HTML parts.

    to modify the style of the "responsive_post_meta_data" function in child theme CSS style sheet; I turned off the "comment[down arrow]" link using the CSS...

    .comments-link {
    	display:none;
    }

    /**
    * This function prints post meta data.
    *
    * Ulrich Pogson Contribution
    *
    */

    responsive_post_meta_data

    if (!function_exists('responsive_post_meta_data')) :
    
    function responsive_post_meta_data() {
    	printf( __( '<span class="%1$s">Posted on </span>%2$s<span class="%3$s"> by </span>%4$s', 'responsive' ),
    	'meta-prep meta-prep-author posted',
    	sprintf( '<a href="%1$s" title="%2$s" rel="bookmark"><span class="timestamp">%3$s</span></a>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_html( get_the_date() )
    	),
    	'byline',
    	sprintf( '<span class="author vcard"><a class="url fn n" href="%1$s" title="%2$s">%3$s</a></span>',
    		get_author_posts_url( get_the_author_meta( 'ID' ) ),
    		sprintf( esc_attr__( 'View all posts by %s', 'responsive' ), get_the_author() ),
    		esc_attr( get_the_author() )
    		)
    	);
    }
    endif;

    This was my modification to the parent function "responsive_post_meta_data"... removed "Posted On" text, removed hyperlink to "date" and "author", and added line break after "date".

    modified child theme CSS to close up line-height.

    .post-meta {
    	clear: both;
    	color: #000;
    	font-size: 21px;
    	line-height: 21px;
    	margin-bottom: 0;
    }

    my modified "responsive_post_meta_data" function.

    if ( ! function_exists( 'responsive_post_meta_data' ) ) :
    
    function responsive_post_meta_data() {
    	printf( __( '<span class="%1$s"></span>%2$s<span class="%3$s"><br /> by </span>%4$s', 'responsive' ),
    	'meta-prep meta-prep-author posted',
    	sprintf( '<span class="timestamp">%3$s</span>',
    		esc_url( get_permalink() ),
    		esc_attr( get_the_time() ),
    		esc_html( get_the_date() )
    	),
    	'byline',
    	sprintf( '<span class="author vcard">%3$s</span>',
    		get_author_posts_url( get_the_author_meta( 'ID' ) ),
    		sprintf( esc_attr__( 'View all posts by %s', 'responsive' ), get_the_author() ),
    		esc_attr( get_the_author() )
    		)
    	);
    }
    endif;
  6. bobschwenkler
    Member
    Posted 8 months ago #

    Super helpful. Thanks so much ggarmento.

  7. Jitendra Mishra
    Cyberchimps Support Rep
    Posted 7 months ago #

    Sorry, we do not monitor these forums, please use the official forum:

    http://cyberchimps.com/forum/

    Thanks

  8. Jitendra Mishra
    Cyberchimps Support Rep
    Posted 7 months ago #

    Sorry, we do not monitor these forums, please use the official forum:

    http://cyberchimps.com/forum/

    Thanks

Reply

You must log in to post.

About this Theme

About this Topic