• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How can I force a line break in a widget title?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › General Discussion › How can I force a line break in a widget title?

This topic is: resolved
  • This topic has 15 replies, 3 voices, and was last updated 9 years, 3 months ago by Summer.
Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • February 10, 2014 at 8:14 pm #89725
    pcgs51
    Member

    Is there a way to force a line break in a widget title because neither <br> or <br /> work. Once a widget is saved the <br> goes away.


    Thanks,
    pcgs51

    February 11, 2014 at 3:52 am #89753
    Davinder Singh Kainth
    Member

    You can check the option to add paragraphs at bottom of widget. It should keep the layout intact. Other options are using:

    <p>&nbsp;</p>

    or

    <br>&nbsp;</br>


    Sunshine PRO genesis theme
    Need Genesis help? Davinder @ iGuiding Media | My Blog | Fresh Genesis Themes

    February 11, 2014 at 6:54 am #89775
    Davinder Singh Kainth
    Member

    Also try this - http://bit.ly/1elZnnL


    Sunshine PRO genesis theme
    Need Genesis help? Davinder @ iGuiding Media | My Blog | Fresh Genesis Themes

    February 11, 2014 at 5:53 pm #89881
    pcgs51
    Member

    Thanks Davinder, I've tried them all and can officially tell you that none of them work. Checking on the add paragraphs box does nothing. Also, I added that last script above to my functions.php and it broke my site entirely.

    My question stands but let me rephrase this: Does anyone know of a way to do this? Have you done it before? I'm using a current version of Genesis and the Epik theme.


    Thanks,
    pcgs51

    February 11, 2014 at 7:20 pm #89882
    Summer
    Member

    GIven how sparse the search results are on this, my guess is not a lot of people have tried it.

    Does using the CR/LF html codes work, instead of &nbsp; ? For some reason, it won't display the HTML code for the characters here, but you can find them here: http://code.cside.com/3rdpage/us/newLine.html

    That said, I haven't tried this myself, but I found this in the wordpress.org support forums:

    add_filter ( 'widget_title' , 'my_widget_title' , 10 , 3 ) ; 
    function my_widget_title ( $title ) { 
       $title = str_replace ( "[br]" , "<br/>" , $title ) ; 
       return $title ; 
    }

    from http://macadamcodeboys.com/2012/12/20/wordpress-des-retours-a-la-ligne-dans-les-widgets/


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    February 11, 2014 at 7:26 pm #89883
    Summer
    Member

    That's weird... my post went away... Let's try again.

    GIven how sparse the search results are on this, my guess is not a lot of people have tried it.

    Does using the CR/LF html codes work, instead of &nbsp; ? For some reason, it won't display the HTML code for those characters here, but you can find them here: http://code.cside.com/3rdpage/us/newLine.html

    That said, I haven't tried this myself, but I found this in the wordpress.org support forums:

    add_filter ( 'widget_title' , 'my_widget_title' , 10 , 3 ) ; 
    function my_widget_title ( $title ) { 
       $title = str_replace ( "[br]" , "<br/>" , $title ) ; 
       return $title ; 
    }

    from http://macadamcodeboys.com/2012/12/20/wordpress-des-retours-a-la-ligne-dans-les-widgets/


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    February 11, 2014 at 7:27 pm #89884
    Summer
    Member

    Hm. Not sure why the forum published my post the first time, and destroyed it on the edit. Maybe it doesn't like me posting multiple links?

    Hopefully a moderator can fix my posts, so the potential for a solution can be found here.

    If not, do a Google search for "wordpress line break in widget title" and look at the first wordpress.org forums link, and follow the link to a French site for a shortcode replacement solution


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    February 11, 2014 at 7:30 pm #89885
    Summer
    Member

    One more time.

    Instead of trying to use <br> in the title, have you tried using the HTML codes for CR or LF? Since the forum won't let me post the characters, you can find them here: http://code.cside.com/3rdpage/us/newLine.html

    If that doesn't work, try the solution offered up here, replacing the HTML break with a shortcode: http://macadamcodeboys.com/2012/12/20/wordpress-des-retours-a-la-ligne-dans-les-widgets/


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    February 11, 2014 at 7:35 pm #89888
    pcgs51
    Member

    Very strange that your post doesn't show up but I did see your message, Summer.

    Your coding suggestion also causes the white screen of death.


    Thanks,
    pcgs51

    February 11, 2014 at 7:35 pm #89889
    Summer
    Member

    This is ridiculous. Not sure why the forum published my post the first time, and destroyed it on the edit. Maybe it doesn't like me posting multiple links? It's happened three times now.

    Hopefully a moderator can fix my posts, so the potential for a solution can be found here.

    If not, do a Google search for "wordpress line break in widget title" and look at the first wordpress.org forums link, and follow the link to a French site for a shortcode replacement solution


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    February 11, 2014 at 7:37 pm #89890
    pcgs51
    Member

    Note to moderator: There is a person attempting to post to this thread but her replies keeps getting deleted. Her name is Summer.


    Thanks,
    pcgs51

    February 11, 2014 at 8:35 pm #89898
    Summer
    Member

    That's strange about the filter not working... I added it to a test site I have running News Pro, and it worked just fine.


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    February 11, 2014 at 8:38 pm #89899
    Summer
    Member

    Let's see if me just putting the code here works:

    add_filter('widget_title','my_widget_title',10,3);
    function my_widget_title($title) {
    $title = str_replace("[br]", "<br/>", $title);
    return $title;
    }

    Adding this filter to functions.php, then using the shortcode [br] in the title of the widget did work for me, using News Pro, Genesis 2.0.2 and WP 3.8.1. Site is running PHP 5.4


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    February 11, 2014 at 8:44 pm #89901
    Summer
    Member

    Just uploaded Epik to my test site and tried it, and it does work there, too.


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

    February 11, 2014 at 9:09 pm #89904
    pcgs51
    Member

    That worked! Thanks for hanging in there and helping out Summer! I actually was asking this on behalf of a friend in a different forum.


    Thanks,
    pcgs51

    February 11, 2014 at 10:08 pm #89912
    Summer
    Member

    Glad we worked around the forum glitches 🙂


    WordPress / Genesis Site Design & Troubleshooting: A Touch of Summer | @SummerWebDesign
    Slice of SciFi | Writers, After Dark

  • Author
    Posts
Viewing 16 posts - 1 through 16 (of 16 total)
  • The forum ‘General Discussion’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2023 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble