How to put a line break in a WordPress page, post or widget title

Do you ever need to put a line break in the title of a WordPress page, post or widget title? It can be frustrating because WordPress doesn’t have a way to do it, and strips out HTML if you type a <br> break tag. The solution: create a shortcode that inserts a break tag. Here’s how…

Go to Appearance > Theme Editor. From the drop-down list on the right side, choose functions.php. That’s a file where you can insert custom code and it won’t get overwritten when the theme gets updated. Insert this code:

function line_break_shortcode() {
 return '<br />';
 }
 add_shortcode( 'br', 'line_break_shortcode' );

Click the Update button on bottom to save the file. Now when you want a line break, just type [br].

Share:

Facebook
Twitter
Pinterest
LinkedIn
On Key

Related Posts

Get in touch