Adding a link in the WordPress tagline

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

You can search the user’s forum or ask the user community by opening a new thread in the Customizr theme forum. Before opening a new topic, you might want to follow the troubleshooting steps..

Howdy developer!

The following is a quick and easy way to add a link in your tagline in the Customizr theme.

We are going to use the ‘tc_tagline_display’ filter to do so. (check how to locate a filter in Customizr)

Copy and paste the following code in the functions.php file of your child theme :

add_filter( 'tc_tagline_display' , 'my_link_in_tagline');

function my_link_in_tagline() {
	global $wp_current_filter;
	?>
		<?php if ( !in_array( '__navbar' , $wp_current_filter ) )  :?>
			<div class="container outside">
		        <h2 class="site-description">
		        	<?php bloginfo( 'description' ); ?>
		        	<a href="[PUT YOUR URL HERE]" title="[A TITLE]">My link</a>
		        </h2>

		    </div>
		<?php else : //when hooked on __navbar ?>
			<h2 class="span7 inside site-description">
	            <?php bloginfo( 'description' ); ?>
	            <a href="[PUT YOUR URL HERE]" title="[A TITLE]">My link</a>
	        </h2>

		<?php endif; ?>
	<?php
}

 Note : in this filter, I use the global $wp_current_filter   to determine in which filtering context we are because the function is used in two different action hook : responsive or not. Another way to check the current filter in WordPress is to use the current_filter()  function, but this one will only show the current hook and not the nested hooks (meaning hooks included in other hooks).

Leave a Reply to Nicolas Cancel reply

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

27 thoughts on “Adding a link in the WordPress tagline”