- This topic has 9 replies, 3 voices, and was last updated 5 years, 6 months ago by Tom.
-
AuthorPosts
-
September 30, 2018 at 9:22 am #690056Evgeniya
Hi,
I have tried to add function from support topic Customize Post Meta but it did not go well. And i have a few more questions about function in post #593641:– How can i add gravatar foto in there?
– How do i make an interval between author’s meta and date? Because now date appears right after author’s meta without even slightest gap.
– How can i make all this post meta appear in this form only in single posts? And in the main page and archive page only show date? Because now in main page and archive page shows author’s meta although i checked off “Display post author” in Customizer.
I don’t understand why post meta doesn’t show right. So far i have added CSS for post updated date:
.posted-on .updated {
display: inline-block;
}.posted-on .updated + .entry-date {
display: none;
}.posted-on .updated:not(:empty):before {
content: “Последние изменения: “;
}In functions.php i have added filter( ‘generate_post_date_output’, ‘tu_author_in_front_of_date’, 10, 2 ) from post #593641.
And i have checked off “Display post author” in Archives.
September 30, 2018 at 8:35 pm #690303LeoStaffCustomer SupportHi there,
– Can you try this code here?
https://generatepress.com/forums/topic/add-author-photo-for-each-post-in-blog-home/#post-335202And to style it, you can the CSS in #2 here:
https://generatepress.com/forums/topic/read-more-button-and-author-gravatar/#post-478526– Are you using any function to display the meta right now? There should be space between them by default.
You can see it here: https://gpsites.co/marketer/– Can we take a step back, remove all your current functions, and test if the customizer features work correctly? You can toggle between archives and single for the blog content:
https://docs.generatepress.com/article/blog-content-layout/Let me know 🙂
October 1, 2018 at 1:17 am #690409EvgeniyaHi, Tom
I removed all functions to add gravatar and to switch places between author’s meta and date. And everything became allright. Customizer works fine.Then i added gravatar whith function from post #335202. And customized css for author’s image. That worked fine too.
But then i tried again to add function from this post to switch places for author and date and checked off ‘Display author’ in customizer like you suggested in that post. It didn’t work well. Author and date did switch places but no space between them and no gravatar.
Maybe exists some other function to get what i want. I actually want posts’s meta like in this blog. Only without field with comments. How can i do that?
October 1, 2018 at 7:28 am #690665LeoStaffCustomer SupportOK can you remove all the code before and just use this instead?
https://generatepress.com/forums/topic/read-more-button-and-author-gravatar/#post-623023I believe it should create the exact thing as this user wanted the same thing in #1:
https://generatepress.com/forums/topic/read-more-button-and-author-gravatar/#post-618006October 1, 2018 at 11:16 am #690937EvgeniyaThank you, Leo.
Now post meta looks great. But i have one more little question:
How can i make post date not a link?
October 1, 2018 at 7:57 pm #691176TomLead DeveloperLead DeveloperGive this a shot:
add_filter( 'generate_post_author', '__return_false' ); add_filter( 'generate_show_comments', '__return_false' ); add_filter( 'generate_post_date_output', 'tu_fancy_byline', 10, 2 ); function tu_fancy_byline( $date, $time_string ) { printf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%4$s<span class="author-name" itemprop="name">%3$s</span></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 ( ! is_single() && ! 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>'; } printf( '<span class="posted-on">%s</span>', $time_string ); }
October 1, 2018 at 10:49 pm #691232EvgeniyaHi, Tom.
I have added the code you provided earlier. Now author’s name is not a link but a post date is still a link.
October 2, 2018 at 9:58 am #691759TomLead DeveloperLead DeveloperI just made an adjustment to the code above. Can you give it another shot?
October 2, 2018 at 10:20 am #691773EvgeniyaHi, Tom.
Thank you for your help. Now post meta is allright. Like i wanted.
But i have to say that function didn’t change anythig at first. Even when i cleared cach several times. And then i decided to check off ‘Display post date’ in customizer to see if anything will be different. It did not. But when i checked on ‘Display post date’ post’s date was not a link. So this is how it worked for me.
Thank you again.
October 2, 2018 at 5:00 pm #691982TomLead DeveloperLead DeveloperAwesome, glad it’s working 🙂
-
AuthorPosts
- You must be logged in to reply to this topic.