• Pino CeniccolaPino Ceniccola, over 8 years ago

    This will break RSS titles, page title and lots of other things. There is a reason why best practices tell you to separate content from presentation.

    10 points
    • Crampa ...Crampa ..., over 8 years ago

      Yeah this is a bad solution to the problem.

      Anywhere you want to display a page/post title, you need to implement str_replace. And since it's tied to the theme, if your client ever changes theme you'll have pipes everywhere!

      2 points
    • Dustin CartwrightDustin Cartwright, over 8 years ago

      Came here to say exactly this. I've used custom fields in the past as my solution. Much more heavy-handed though as it requires some CSS/theme customization too. I set mine up so that if the custom field for my title was used, it replaced the built-in WP title on blog and permalink pages.

      RSS still saw the built-in WP titles, and I still got my customized formatting for titles on the site itself. Win-win!

      0 points
  • Sam SolomonSam Solomon, over 8 years ago

    Short post, cool solve. Have an upvote!

    1 point
  • Dakota ChichesterDakota Chichester, over 8 years ago

    I don't believe this is a very good solution. The main WP title should stay clean for use in the Admin, RSS,

    tag, etc. I would rather implement an additional title field in the admin and allow tags or some other HTML element to signify breaks, then that "Editorial Title" can be output on the page.

    For several of my editorial sites we already implement similar alternate title fields for things such as a short story title or a combined hed/dek title.

    It would be worth exploring options other than an actual tag to indicate breaks since at different breakpoints that title should probably break at different points

    0 points
  • Updula LeeUpdula Lee, over 8 years ago

    Can't think of another solution, but this could really break the content later on. At least try applying it using a separate plugin, so whenever your client changes the theme, he won't lose these line breaks.

    0 points
  • Oscar MarceloOscar Marcelo, over 8 years ago

    This would be better accomplished by using a hook. Doing this will affect all functions who outputs the title.

    I suggest an IF statement, to just remove those extra characters and leave the title in just one line on special cases like RSS, meta tags, etc...

    0 points
  • Cihad TurhanCihad Turhan, over 8 years ago

    How about using real enter character and using?

    h1{ white-space: pre; }

    Won't it work?

    0 points
    • Clark WimberlyClark Wimberly, over 8 years ago

      What is a real enter character? Not sure I know how to create one, which means I assume my user wouldn't either.

      0 points
      • Cihad TurhanCihad Turhan, over 8 years ago

        I mean type something, hit enter key and continue typing. I have a little knowledge about WordPress. Doesn't it let you enter \n characters?

        0 points