• Hi,

    I’m using below codes in custom plugin to print logo without ID & class:

    add_filter( 'get_custom_logo', 'wpse250683_custom_logo_output' );
    
    function wpse250683_custom_logo_output() {
        $custom_logo_id = get_theme_mod( 'custom_logo' );
        $attachment     = wp_get_attachment_image_src( $custom_logo_id, 'full', false );
        $attachment_url = '';
        if ( is_array( $attachment ) )
            $attachment_url = $attachment[0];
        $html = sprintf( '<a href="%1$s"><img src="%2$s" /></a>',
            esc_url( home_url( '/' ) ),
            $attachment_url
        );
        return $html;
    }

    Code above taken from https://wordpress.stackexchange.com/a/250687/81766

    When activating KingComposer, the logo replaced with wp-content/plugins/kingcomposer/assets/images/get_start.jpg instead of theme logo

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hi rajitrazaki,

    Thank you for your inform.

    Because your input logo is not avaiable, that why it show blank image.

    You can use code bellow:

    
    add_filter( 'get_custom_logo', 'wpse250683_custom_logo_output' );
    
    function wpse250683_custom_logo_output() {
    	$custom_logo_id = get_theme_mod( 'custom_logo' );
    	if($custom_logo_id > 0){
    		$attachment     = wp_get_attachment_image_src( $custom_logo_id, 'full', false );
    		$attachment_url = '';
    		if ( is_array( $attachment ) )
    			$attachment_url = $attachment[0];
    		$html = sprintf( '<a href="%1$s"><img src="%2$s" /></a>',
    			esc_url( home_url( '/' ) ),
    			$attachment_url
    		);
    		return $html;
    	}
    }
    Thread Starter rajitrazaki

    (@rajitrazaki)

    Thank you very much ??

    You are welcome.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Interfere if print logo without ID & class’ is closed to new replies.