Site logo

[Support request] Menu Customization

Home Forums Support [Support request] Menu Customization

Home Forums Support Menu Customization

Viewing 7 posts - 16 through 22 (of 22 total)
  • Author
    Posts
  • #2323324
    David
    Staff
    Customer Support

    Please raise a separate topic for each unrelated issue. This will allow us to focus on one requests at a time.
    Back to the Navigation.

    You can social icons and other buttons in the navigation by:

    1. Create a new Block Element in Appearance > Elements.
    2. Set the Hook to: menu_bar_items
    3. Add whatever blocks or other content you require to the element editor.
    4. Any block you want to hide on different devices, select the block and in Advanced > Additional CSS Classs(es) add one of the GP hide-on-* classes:

    https://docs.generatepress.com/article/responsive-display/#using-our-hide-on-classes

    #2324237
    Ravi Saive

    Thanks David.

    One last query, I can’t see “Display comment count” on a single post here – https://i.postimg.cc/prjTXhK4/comment.png

    #2324258
    Fernando
    Customer Support

    There’s no such option in the customizer for Single. It’s only for Archives.

    You can try adding this Snippet to add it on single posts:

    add_action( 'wp', function() {
        if ( !is_admin() && is_single() ) {
            add_filter( 'generate_show_comments', '__return_true' );
        }
    } );
    
    add_filter( 'generate_header_entry_meta_items', function( $items ) {
        return array_diff( $items, array( 'comments-link' ) );
    } );

    Adding PHP reference: https://docs.generatepress.com/article/adding-php/#code-snippets

    #2324271
    Ravi Saive

    Hi Fernando,

    The given code is not working…

    I am using the following code on the Live site GP version 2.4.2, which displays the tags properly…

    /Meta Tags in one line
    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"><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() )
            )
        );
    } );
    
    add_filter( 'generate_header_entry_meta_items', function() {
        return array(
            'author',
            'date',
            'categories',
            'comments-link',
        );
    } );
    
    add_filter( 'generate_footer_entry_meta_items', function( $items ) {
        return array_diff( $items, [ 'categories', 'comments-link' ] );
    } );
    

    But the same code on the GP version 3.1.3 on staging site not working see – https://i.postimg.cc/prjTXhK4/comment.png

    #2324281
    Fernando
    Customer Support

    Try adding this below that code:

    add_action( 'wp', function() {
        if ( is_single() ) {
            add_filter( 'generate_show_comments', '__return_true' );
        }
    } );
    #2324325
    Ravi Saive

    Thanks, Fernando, it works…:)

    #2326636
    Fernando
    Customer Support

    You’re welcome Ravi!

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