- This topic has 22 replies, 3 voices, and was last updated 4 years, 9 months ago by Tom.
-
AuthorPosts
-
July 20, 2019 at 12:00 am #962406Ronja
Ok, so the php is:
add_filter( 'generate_post_author_output', function() { return sprintf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ), esc_html( get_the_author() ), get_avatar( get_the_author_meta( 'ID' ) ) ) ); } ); add_filter( 'generate_header_entry_meta_items', function() { return array( 'author', 'comments-link', 'date', ); } ); add_filter( 'generate_footer_entry_meta_items', function( $items ) { return array( 'date', 'categories', ); } ); add_action( 'after_setup_theme', function() { remove_action( 'generate_after_entry_title', 'generate_post_meta' ); add_action( 'generate_after_entry_header', 'generate_post_meta', 15 ); } );
The CSS:
.byline img { width: 25px; height: 25px; border-radius: 50%; position: relative; vertical-align: middle; margin: 0 10px 0 0; } .comments-link .posted-on { border-left: 1px solid #ddd; padding-left: 10px; margin-left: 10px; } .post-image + .entry-meta > * { display: inline-block; } .posted-on .updated { display: inline-block; } .posted-on .updated + .entry-date { display: none; } .posted-on .updated:before { content: "Zuletzt aktualisiert: "; }
July 20, 2019 at 7:19 am #962602TomLead DeveloperLead DeveloperHi there,
Try this as your PHP:
add_filter( 'generate_post_author_output', function() { printf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<a href="%1$s" title="%2$s" rel="author"><span class="author-name" itemprop="name">%3$s</span></a></span>', esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ), esc_attr( sprintf( __( 'View all posts by %s', 'generatepress' ), get_the_author() ) ), esc_html( get_the_author() ), get_avatar( get_the_author_meta( 'ID' ) ) ) ); if ( ! post_password_required() && ( comments_open() || get_comments_number() ) ) { echo '<span class="comments-link">'; comments_popup_link( __( 'Leave a comment', 'generatepress' ), __( '1 Comment', 'generatepress' ), __( '% Comments', 'generatepress' ) ); echo '</span>'; } } ); add_filter( 'generate_header_entry_meta_items', function() { return array( 'author', 'date', ); } ); add_filter( 'generate_footer_entry_meta_items', function( $items ) { return array( 'date', 'categories', 'post-navigation', ); } ); add_action( 'after_setup_theme', function() { remove_action( 'generate_after_entry_title', 'generate_post_meta' ); add_action( 'generate_after_entry_header', 'generate_post_meta', 15 ); } );
Let me know π
July 21, 2019 at 2:22 am #963171RonjaHi Tom,
I tried to add this php, as soon as I click the “save” button a error page opens saying “page not found”
July 21, 2019 at 8:59 am #963489TomLead DeveloperLead DeveloperHow are you adding it? Code Snippets?
July 21, 2019 at 1:31 pm #963640RonjaYes, I’m using the code snippets plugin
July 21, 2019 at 3:58 pm #963687TomLead DeveloperLead DeveloperNot sure why it would go to a not found page. Does it work if you save the old code?
July 24, 2019 at 9:40 pm #966558RonjaHi Tom,
It does save the old code.
I think I’ll just leave it for the time being and maybe try it again as soon as I have more coding skills.
Thank you so much for your patience with me, you’re doing a great job! π
Cheers, RonjaJuly 25, 2019 at 9:12 am #967115TomLead DeveloperLead DeveloperVery strange, I just tried the code and it all worked as it should. If you give it another shot, be sure to copy the entire block of code.
Thank you! π
-
AuthorPosts
- You must be logged in to reply to this topic.