Manipulating Site Logo

In Themify themes, there's a function that outputs the logo image and site title, themify_logo_image. This is a reusable function that can be used to output your logo anywhere in the templates. The function definition is as follows:

themify_logo_image($location, $cssid)

Parameters

$location, defines the location where the logo is called, used to check if the logo uses an image in theme settings (remember you can define additional setting modules) and for filter definitions.
Default is 'site_logo'.

$cssid, used for the HTML id attribute. Default is 'site-logo'.

As an example, the header logo is usually rendered as

<?php
 echo themify_logo_image(); ?>

while the footer logo, like in Eleming theme, is called as

<?php echo themify_logo_image('footer_logo', 'footer-logo'); ?>

Filters

There are a variety of filters available to modify the output:

themify_logo_home_url, filters the URL pointed by the logo image and site title.

themify_{location}_logo_html, where location is a string, filters the full HTML returned.

Replacing the URL

Follow these steps:

1. Create a file named custom-functions.php in your theme root folder

2. Edit it, and paste the following


<?php

/**
 * Return a different URL to link the logo to.
 * @param string $url The original site's home URL.
 * @return string The modified or different URL.
 */
function custom_themify_logo_home_url($url) {
    return 'https://themify.me/';
}

// Apply filter to the logo URL
add_filter('themify_logo_home_url', 'custom_themify_logo_home_url');
?>

3. Save the file. If you were editing it locally, upload it by FTP to the theme folder in your server.

If you want to completely remove the logo output, you can use this code in custom-functions.php instead:


<?php

/**
 * Return empty HTML for site logo, thus removing it.
 * @param $html
 * @return string
 */
function custom_themify_remove_logo($html) {
	return '';
}

// Remove logo on header
add_filter( 'themify_site_logo_logo_html', 'custom_themify_remove_logo' );

// Remove logo on footer
add_filter( 'themify_footer_logo_logo_html', 'custom_themify_remove_logo' );

?>