Alt header logo and link for specific pages

Building a WP site where two parent categories are styled to look like two distinct sections/sites.

I’m using the custom logo (set in Appearance/Customise) and using the function below I can successfully replace this with a custom logo on specific pages and categories. How can I also include a custom link rather than site home?

function change_logo_on_category($html) {

if (is_page($page = ‘136’))

$html = preg_replace(‘/<img(.*?)/>/’, ‘<img
src=”http://customlogo.png” class=”custom-logo” alt=””
itemprop=”logo” />’, $html);

elseif ( in_category( 29 ) || post_is_in_descendant_category( 29 ))

$html = preg_replace(‘/<img(.*?)/>/’, ‘<img
src=”http://customlogo.png” class=”custom-logo” alt=””
itemprop=”logo” />’, $html);
return $html;
}
add_filter(‘get_custom_logo’,’change_logo_on_category’);

Read more here:: Alt header logo and link for specific pages

Leave a Reply

Your email address will not be published. Required fields are marked *