Are you a GenerateCustomer?

Do you have an active GP Premium or GenerateBlocks Pro license key?

Create a GenerateSupport account for GeneratePress and GenerateBlocks support in one dedicated place.

Create an account
Already have a GenerateSupport account? Login

Just browsing?

Feel free to browse the forums. Support for our free versions is provided on WordPress.org (GeneratePress, GenerateBlocks).

Want to become a premium user? Learn more below.

How do I centre post author

  • 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.

  • Hi there,

    Could you share the page where I can view the post author text?

  • 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/

  • 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

  • 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.

  • 🙏 And one final question (yeah right)

    How do I change the font color and weight of author?

    TIA

  • 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;
    }
  • 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 ?

  • What does the “Remove Author Link” snippet do ? 🙂

  • 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 ?

  • Your screenshot shows the option under the Single tab, can you check the Archive tab?

Viewing 16 posts - 1 through 16 (of 22 total)
  • You must be logged in to reply to this topic.