How to add a text in the header right side with logo enabled
- This topic has 0 replies, 1 voice, and was last updated 10 years ago by .
Viewing 1 post (of 1 total)
Viewing 1 post (of 1 total)
- You must be logged in to reply to this topic.
Hello,
I created a Custom Menu item in a header menu to show a text (the site description) on the right side of the header, with a logo enabled on the left side. There is no page and no URL associated to this custom menu item, and the site description appears on the first position of the header menu. The text is also unclickable with no hand when hovering on it.
But this is not a good solution, because the text of this custom menu item appears on the “Mobile Menu” (the new menu appearing on small sized screens). And this text becomes clickable, and it gives a 404 error page. It seems there’s also no way to remove an item from the Mobile Menu container only.
So, because the text doesn’t have to be considered as a menu, rather than putting it in a custom menu in header I think developpers would prefer using hooks to insert a text on the right side of the header!
I am now thinking of adding a php code like this in my child theme’s functions.php file:
<?php
/* Site Description in Header Rightside */
add_filter( ‘header_rightside_text’, ‘description_in_header_rightside’ );
function description_in_header_rightside() {
echo ‘<h2 id=”site-description”>TAGLINE ENTERED FROM THE DASHBOARD</h2>’;
}
(Of course some CSS must be added after to position the text correctly).
I’m not sure if “site-description” is in <h2> or <h1> with CBOX environment and I’m not sure if my code is correct or the best one.
If someone can give an easier code or give the most efficient solution, any help will be appreciated.