- This topic has 19 replies, 3 voices, and was last updated 6 years, 5 months ago by
Tom.
-
AuthorPosts
-
October 29, 2019 at 9:51 am #1047997
Tom
Lead DeveloperLead DeveloperPlug this PHP into your site:
add_filter( 'generate_header_entry_meta_items', function() { return array( 'author', 'date', ); } ); add_filter( 'author_link', function( $link, $author_id ) { $url = get_the_author_meta( 'user_url', $author_id ); if ( $url ) { $link = $url; } return $link; }, 10, 2 ); add_filter( 'generate_post_author_output', function() { return sprintf( '<span class="byline"><span class="author vcard" %5$s>%1$s <a class="url fn n" href="%2$s" title="%3$s" rel="author" itemprop="url"><span class="author-name" itemprop="name">%4$s</span></a></span></span> ', __( 'Published by', 'generatepress' ), esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), /* translators: 1: Author name */ esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ), esc_html( get_the_author() ), generate_get_microdata( 'post-author' ) ); } ); add_filter( 'generate_post_date_output', function( $output, $time_string ) { $time_string = '<time class="entry-date published" datetime="%1$s" itemprop="datePublished">%2$s</time>'; if ( get_the_time( 'U' ) !== get_the_modified_time( 'U' ) ) { $time_string = '<time class="entry-date updated-date" datetime="%3$s" itemprop="dateModified">%4$s</time>'; } $time_string = sprintf( $time_string, esc_attr( get_the_date( 'c' ) ), esc_html( get_the_date( 'F j, Y' ) ), esc_attr( get_the_modified_date( 'c' ) ), esc_html( get_the_modified_date( 'F j, Y' ) ) ); return sprintf( '<span class="posted-on">Updated on %1$s at %2$s</span> ', $time_string, get_the_modified_time( 'g:i A' ) ); }, 10, 2 );Then add this CSS:
.entry-header .entry-meta > span { display: block; }That should give you that exact result 🙂
October 29, 2019 at 10:11 am #104801493487u5tr938ouh4trnos8fyoh
Wow thank very much, that’s a lot of code. I didn’t think it require so much. So, really thanks. Do I add this in the before hook or this is site wide PHP without matter of placement?
October 29, 2019 at 2:44 pm #1048217David
StaffCustomer SupportHi there,
you would add this to either your Child Themes funtcion.php or use the code snippets plugin.
October 30, 2019 at 12:12 am #104847193487u5tr938ouh4trnos8fyoh
Thank you very much!
October 30, 2019 at 8:49 am #1048957Tom
Lead DeveloperLead DeveloperYou’re welcome 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.