• I’m trying to change the logo based on the page id and on some pages change the logo to use the featured image.

    For the first part of changing the logo based on the page id, I saw some code snippets on the forum, but for some reason I cannot get either to work. Here is the code I have tried:

    add_filter('tc_logo_src', 'my_logo');
    function my_logo($original){
    	if (is_page(2043) )
    		return esc_url( '/wp-content/uploads/Logo_1');
    	elseif (is_page(553)
    		return esc_url( '/wp-content/uploads/Logo_2');
    	else return $original;
    }
    add_filter('tc_logo_title_display', 'my_logo_title_display');
    function my_logo_title_display($output);
    $default_logo_location = '/wp-content/uploads/Logo_1.jpg';
    	if (is_page(array('2043')))
    		return preg_replace('|'.preg_quote($default_logo_location,'|' ).'|', '/wp-content/uploads/Logo_2.jpg', $output);
    	elseif (is_page(array('553')))
    		return preg_replace('|'.preg_quote($default_logo_location,'|' ).'|', '/wp-content/uploads/Logo_3.jpg', $output);
    	else return $output;
    }

    If I can get that working, I want to add elseif statements to use the featured image instead of a page id. Any ideas?

Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Change logo based on page id and use featured image’ is closed to new replies.