Viewing 15 replies - 1 through 15 (of 16 total)
  • Hi there,

    those are the Author Links in your Post Meta. You could try adding some padding to the link when on smaller devices to increase the target size like so:

    @media (max-width: 420px) {
        .entry-meta .byline a {
            display: inline-block;
            padding: 10px 0;
        }
    }
    Thread Starter Shivam Pandey

    (@wikihelp360)

    You Are Amazing David, I Love Your Support. You Solved My Problem, I am Very Happy, Thank You Very Much. God Bless You @diggeddy

    A pleasure to be of help. And thank you for the kind words.

    Thread Starter Shivam Pandey

    (@wikihelp360)

    Hello David, I removed that CSS code because the website’s Post Meta Data does not look good on mobile. I have attached the screenshot. Please help me…
    Post Meta Data.png

    You can try this which will force the byline to a whole new line:

    @media (max-width: 420px) {
        .entry-meta .byline  {
            display: block;
            padding: 10px 0;
        }
    }

    Other then that there isn’t much else to be done.

    Thread Starter Shivam Pandey

    (@wikihelp360)

    It still doesn’t look good.
    Post Meta Data-2.png

    Leo

    (@leohsiang)

    What doesn’t look good?

    Can you specify what you’d like to see/change?

    Thread Starter Shivam Pandey

    (@wikihelp360)

    Hey David, I want to know that how can I show the Post Meta Data with Gravatar in GeneratePress Theme like this:
    Post Meta Data-3.png

    Leo

    (@leohsiang)

    Thread Starter Shivam Pandey

    (@wikihelp360)

    I checked the documentation and I like the “Example 1” post meta style. But I have doubt where I will add below PHP code.

    add_filter( 'generate_post_author_output', function() {
        return sprintf( ' <span class="byline">%1$s</span>',
            sprintf( '<span class="author vcard" itemtype="https://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',
        );
    } );
    • This reply was modified 5 years, 3 months ago by Shivam Pandey.
    Thread Starter Shivam Pandey

    (@wikihelp360)

    Is the above code a custom function? If yes, how can I add this code through File Manager (cPanel)? I don’t want to use any plugin.
    what happens when I update the theme? Theme containing this function or overwritten by a new one.

    This article explains how to add PHP to your site:

    https://docs.generatepress.com/article/adding-php/

    Info on child theme:

    https://docs.generatepress.com/article/using-child-theme/

    The Code Snippets plugin is the alternative. It adds no overhead to the front end and is the easiest way to go.

    Thread Starter Shivam Pandey

    (@wikihelp360)

    Hello David,
    I asked you that the code given below is a custom function or not?

    add_filter( 'generate_post_author_output', function() {
        return sprintf( ' <span class="byline">%1$s</span>',
            sprintf( '<span class="author vcard" itemtype="https://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',
        );
    } );

    Yes, it is a custom function and the code is PHP – the articles provided explain the secure way of adding them to the theme.

    Thread Starter Shivam Pandey

    (@wikihelp360)

    Thank you for clarification David, What happens when I update the theme? Theme containing this custom function or overwritten?

Viewing 15 replies - 1 through 15 (of 16 total)
  • The topic ‘Getting an Error in GeneratePress Theme’ is closed to new replies.