Your site’s tagline is used to explain, in a few words, what the site is about. But maybe you want to use it for something else, or maybe you need more than a few words.
There’s a downside to using your tagline for other things: search engines know Wordpress so well that they will expect to find a site description there and not, for example, an address. But it’s your site and you can do what you want with it, right? This article shows you how.
If you want to add just one or two simple extra lines (with no html tags), you can use a CSS solution. If you need more than that (or you need to use html tags), then you will need to use a more complex php solution.
Adding one/two extra lines with simple CSS
Where to copy/paste this code?
The simplest way is to use the Custom CSS section of the customizer option screen. If you have many customizations to make in CSS and PHP, then We strongly recommend you create a child theme. Everything you need to know about creating a child theme with Customizr here.
To add a second/third line (which contains no html) to the tagline, put the following in your Custom CSS or child-theme’s stylesheet:
/* START OF Adding a multi-line tagline */ .site-description:before { content: "This is an extra tagline above the existing Tagline"; display: block; text-align: right; } .site-description:after { content: "This is an extra tagline below the existing Tagline"; display: block; text-align: right; } /* END OF Adding a multi-line tagline */
Credit: @paulwpxp/@Bob
Adding multiple extra lines with php
Where to copy/paste this code?
We strongly recommend you create a child theme and add this to the Child Theme functions.php.
Download a start-up child theme here.
Remember: you shouldn’t edit the theme’s functions.php.
// START OF Adding a multi-line tagline add_filter( 'tc_tagline_text', 'my_tagline_text' ); function my_tagline_text($html) { $myExtraTaglines = '
This is my 2nd line
This is my 3rd line
This is my 4th line
‘; $html = $html . $myExtraTaglines; return $html; } // END OF Adding a multi-line tagline
Then you can style each line as required, for example:
/* START OF Adding a multi-line tagline */ h4.site-description {Add CSS here;} h5.site-description {Add CSS here;} h6.site-description {Add CSS here;} /* END OF Adding a multi-line tagline */
40 thoughts on “Adding a multi-line tagline”
Hi,
Add this
or this
to your child theme’s style.css
Hi, a great theme and a great snippet, thanks! I used the php method to display two additional Tag Lines but now have a problem with them in that they display on one line (not on two separate ones) and I can’t figure out how to separate them. Would you be able to suggest a fix? Thanks a million.
Hiya,
It works great on desktop but on Mobile mode the writing is all squished in one corner, I added the css below but nothing seems t change
/* END OF Adding a multi-line tagline */
@media {
h4.site-description {
font-size: 5px;
padding-left: 0;
margin-top: 15px;
}
sorry ignore ( /* END OF Adding a multi-line tagline */ ) don’t know how that ended up in the comment.
Thanks
Marina
I echo the fact that the Custom CSS method appears not to work currently.
Pasting this code into Custom CSS displays correctly in the adjacent preview, but on saving and publishing it does not appear on the live site.
Opening Custom CSS again shows that forward slashes have been introduced into the code for ‘content’.
Rocco has just confirmed: Since Customizr 3.3.1 (Customizr-Pro 1.0.12), because of new wp themes guidelines, you cannot use single (double) quotes in the Custom CSS in customizer. You need a child-theme.
I’ll update the Snippet to reflect this. Thanks for pointing it out.
With the latest version of customizr pro as of 15 Aug 2015 the css method to add simple text multi-line tagline does not seem to work in Firefox anymore.
Have just tested in FF / Czr 3.4.8 / WP 4.3 and the CSS code still works for me.
Suggest you post in the Support Forum with details of your site so we can see what is happening.
Bonjour Nicola & Dev!
I was trying to include a link or a button in the secondary tagline. I was trying to include a link by using the next code but it doesn’t work.
Please, could you help me to include a button (or a link) in a secondary tagline (just like “Go Pro” & “Demo” buttons you have in this page).
Thanks, I really consider you’re doing an amazing work with Customizr.
I feel I didn’t explain it well at all, I would like just to include buttons (like “Go Pro” & “Demo” buttons you have here) in a secondary tagline.
Hi Borja, thanks for your nice comment 🙂
Would you mind posting this second tagline request on the customizr support forum ?
We are currently trying to answer all message there.
Thanks !
Just found rogue code which hid some of the code, so now fixed.
The lines I’ve added are all in H2. Can you help explain how to assign each line to H3, H4, etc? I am only able to add CSS to all the lines. Thanks!
Hi Kevin,
With the filter named ‘tc_tagline_display’ , you can replace the entire tagline by your own, and add as amny headings or html that you want.
See how it looks in the code here : https://github.com/Nikeo/customizr/blob/master/inc/parts/class-header-header_main.php#L437
Hope this helps!
Nicholas, This didn’t work for me but you helped lead me down a different path. Not sure if for better or worse but it it works! Here’s what I did:
$myExtraTaglines = ‘First line of text’;
Thank you!
(Sorry for the double post. Can someone delete the other one?)
Here is the code:
The div keeps getting chewed up. Sorry here it is without the Contact us today for a free estimate! DIV ‘;
When I use this code, the lines all get bunched into H2 and I cannot add custom CSS to each line.
I was unable to get the PHP version to work since updating, however I believe that it was to do with the hook – specifically, there is a space after tc_tagline_text before the apostrophe than needs to be removed. It is now working again for me. (WP4.1, Customizr 3.2.17)
Thanks for reporting this Alex 🙂
I can’t get the php code to work either, even when trying to set a higher priority 🙁
i try dave snippets but its doesnt work,did i missing something??
add_filter( ‘tc_tagline_text ‘, ‘my_tagline_text’ );
function my_tagline_text($html) {
$myExtraTaglines = ‘
This is my 2nd line
This is my 3rd line
This is my 4th line
‘;
$html = $html . $myExtraTaglines;
return $html;
}
——————
is not working aftr version update??
Hi Yogesh, it may be a hook priority problem. Try to set a higher priority like :
add_filter( ‘tc_tagline_text ‘, ‘my_tagline_text’ , 40 );
I hope this will help,
Nicolas.
Thanks, very helpful!
Keep up 🙂
This is a great snippet. I’m not a coder, I’ve done my own WordPress theme in Artisteer, and I’d like to break up BOTH the Title and the tagline. Would your snippet lend itself to also breaking up the Title? Thanks!
Hi Audentes, those snippets are specific to the Customizr WordPress theme and will not work in any other WordPress themes.
Best
Dave,
Since the css :after location seemed to work in your snippet above, I tried your technique using the css :before location and was able to make a 3 line tagline without modifying the function.php. This makes the normal tagline the middle line or line 2 of 3 and the :before and :after as you would expect. Is this ok, or does it have site performance implications?
That’s fine Bob, unless you can see a marked slowdown (but I doubt it).
With css and php there’s always different solutions to achieve the same aim. If you’re running a large, commercial site with multi-hits then it might need analysing but I doubt you’re in that space!
I’ve updated the snippet.
Dave or Nicolas,
This 3 line tagline css has worked great for me since May 2014, but with the 3.3.1 update my css content gets broken with added slashes – content: “line1” shows correctly in the customize edit window, but when saved and then the exiting the customize window, the css line gets changed to content: /”line1″/
After trying this multiple times, it quit breaking the tagline. I’m not sure what happened or if a plug-in was an issue or something.
Hi Bob,
due to new themes guidelines the custom css box content is sanitized with wp_filter_nohtml_kses.
https://github.com/Nikeo/customizr/commit/b562c8d8923988ac4c3bce3bee421e090e5a086a
So you cannot use quotes and double quotes in it anymore.
You should use a child-theme for that.
Hope this helps.
Thanks – worked great!
Ops, this is the second code option:
Hi, thanks for the snippet.
I have to add a shortcode in the 2nd line that will show up some language flags, the code could be placed like this:
or in the following way
.
Any suggestions?
Hi David, you might rather want to adapt this snippet : add a link in WordPress tagline, and replace the link by :
Hope this will help and enjoy the theme
WOW works great, deserved my dinner and a glass (2-3) of wine, thank you so much Nicolas 😀
Hello, Why when I am using this code, it is impossible to copy/paste the text ? It is important for me because, it is my mail address.
Thanks
Take a look above – I’ve improved the Snippet.
Thanks for the feedback.
Hi, thank you for a nice code snippet. Do you have any idea how i can translate secondline of tagline when i use polyland as a translator plugin. Thanks