-
Robin Harford
Hi there
How do I centre post author? I tried this, but it doesn’t appear to work:
.post-author { text-align: center; }
And I want it unlinked. Currently links to my author profile.
TIA.
-
Alvind
Hi there,
Could you share the page where I can view the post author text?
-
Robin Harford
-
Alvind
You can use this CSS:
.single-post .entry-meta { text-align: center; }
And I want it unlinked. Currently links to my author profile.
To remove the author link, you’d need to add this snippet:
add_filter( 'generate_post_author_output','tu_no_author_link' ); function tu_no_author_link() { printf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <span class="fn n author-name" itemprop="name">%4$s</span></span>', __( 'by','generatepress'), 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() ) ) ); }
Adding PHP: https://docs.generatepress.com/article/adding-php/
-
Robin Harford
Thanks.
One final thing:
1. How do I increase the font size of the author?
2. How do I decrease the space/gap between the post title and the author?
TIA
-
Alvind
You can replace the previous CSS with this one:
.single-post .entry-meta { text-align: center; font-size: 18px; } h1.entry-title { margin-bottom: 10px; }
Feel free to adjust the values to your preference.
-
Robin Harford
🙏 And one final question (yeah right)
How do I change the font color and weight of author?
TIA
-
Alvind
Just add these properties to the previous CSS:
font-weight: 900; color: red;
So the final CSS will be:
.single-post .entry-meta { text-align: center; font-size: 18px; font-weight: 900; color: red; }
-
Robin Harford
And one final thing (I hope). I cannot see the author link on my blog posts here, https://www.eatweeds.co.uk/page/2
TIA
-
Hi Robin
do you have any PHP Snippets that alter the display of post meta ?
-
Robin Harford
Only these, https://share.cleanshot.com/YQPkfMg3
-
What does the “Remove Author Link” snippet do ? 🙂
-
Robin Harford
It is the code Alvind gave me earlier today to remove linked author name so only the name shows (no link). Here’s the code:
add_filter( 'generate_post_author_output','tu_no_author_link' ); function tu_no_author_link() { printf( ' <span class="byline">%1$s</span>', sprintf( '<span class="author vcard" itemtype="http://schema.org/Person" itemscope="itemscope" itemprop="author">%1$s <span class="fn n author-name" itemprop="name">%4$s</span></span>', __( 'by','generatepress'), 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() ) ) ); }
-
Ah ok… sorry I should have seen that.
If you go to Customiser > Layout > Blog –> Single tab:https://docs.generatepress.com/article/blog-content-layout/#single
Is the Display Author checked there ?
-
Robin Harford
Indeed it is, see https://share.cleanshot.com/VsjVv7XH
-
Your screenshot shows the option under the
Single
tab, can you check theArchive
tab?
- You must be logged in to reply to this topic.