Modify post-meta output?
-
I’d like to change the formatting/wording of the post meta. Where’s the php file that generates the post meta?
-
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://ww.wp.xz.cn/plugins/all-in-one-seo-pack/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.
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
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;Super helpful. Thanks so much ggarmento.
Sorry, we do not monitor these forums, please use the official forum:
Thanks
Sorry, we do not monitor these forums, please use the official forum:
Thanks
The topic ‘Modify post-meta output?’ is closed to new replies.
