Site logo

[Support request] I need to display one word after logo

Home Forums Support [Support request] I need to display one word after logo

Home Forums Support I need to display one word after logo

Viewing 6 posts - 1 through 6 (of 6 total)
  • Author
    Posts
  • #2477849
    Anoop Kumar Vaishya

    generate_before_logo or generate_after_logo none of them working.

    What could be issue?

    #2477968
    David
    Staff
    Customer Support

    Hi there,

    do you have a Logo Image set on your site ?

    #2478163
    Anoop Kumar Vaishya

    It is presently set using two methods at the same time

    // Inline Logo for Desktop

    add_filter( 'generate_logo_output', function( $output ) {
    	printf(
    		'<div class="navigation-branding site-logo">
    			<a href="%1$s" title="%2$s" rel="home">
    				
    <svg ...... </svg>
    			</a>
    		</div>',
    		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
    		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) )
    	);
    } );

    // Logo for Mobile Header loaded via wp-content File URL.
    Customizing ▸ Layout > Header

    What I am expecting.

    1. Ideally, I would like to set logo inlined for Desktop and Mobile Header both. Note: I don’t use sticky but for some reason I have like this.
    2. Using Elements > Hooks > If I am using generate_after_logo then nothing appears. Ref: https://i.imgur.com/XqDIiXy.png I have checked source code before writing this.

    Please provide solution for both things.

    Thanks

    #2478294
    David
    Staff
    Customer Support

    Lets focus on the desktop first.
    As you’re using the generate_logo_output filter then you can include you extra HTML in there eg.

    add_filter( 'generate_logo_output', function( $output ) {
    	printf(
    		'<div class="navigation-branding site-logo">
    			<a href="%1$s" title="%2$s" rel="home">
                    <svg ...... </svg>
    			</a>
                <p>Your extra text here</p>
    		</div>',
    		esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
    		esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) )
    	);
    } );
    #2478302
    Anoop Kumar Vaishya

    Hello!

    Thank you for understanding my question.

    The provided solution works as expected.

    Kindly provide snippet for mobile header logo as well.

    Thanks

    #2478726
    David
    Staff
    Customer Support

    For mobile header logo you can use the generate_mobile_header_logo_output filter. Doc with some examples here:

    https://docs.generatepress.com/article/generate_mobile_header_logo_output/

    Repurposing the first example:

    add_filter( 'generate_mobile_header_logo_output', function( $output ) {
        if ( ! function_exists( 'generate_menu_plus_get_defaults' ) ) {
            return $output;
        }
    
        $settings = wp_parse_args(
            get_option( 'generate_menu_plus_settings', array() ),
            generate_menu_plus_get_defaults()
        );
    
        return sprintf(
            '<div class="site-logo mobile-header-logo">
                <a href="%1$s" title="%2$s" rel="home">
                    <img src="%3$s" alt="%4$s" />
                </a>
                <p>Your extra text here</p>
            </div>',
            esc_url( apply_filters( 'generate_logo_href' , home_url( '/' ) ) ),
            esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) ),
            esc_url( apply_filters( 'generate_mobile_header_logo', $settings['mobile_header_logo'] ) ),
            esc_attr( apply_filters( 'generate_logo_title', get_bloginfo( 'name', 'display' ) ) )
        );
    } );
Viewing 6 posts - 1 through 6 (of 6 total)
  • You must be logged in to reply to this topic.