Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Line break in title
#1
Is there any way to force line break (or   ) in page/article titles? 
Reply
#2
You can maybe use a component instead of the page title
Reply
#3
non breaking title

force a line break is something else..

line breaking<Br/>title

however html in titles will be deprecated in 3.4 probably. But for now it kind of works, as a "feature"
NEW: SA Admin Toolbar Plugin | View All My Plugins
- Shawn A aka Tablatronix
Reply
#4
(2015-06-24, 08:42:04)shawn_a Wrote: non breaking&nbsp;title

force a line break is something else..

line breaking<Br/>title

however html in titles will be deprecated in 3.4 probably. But for now it kind of works, as a "feature"

Thanks Shawn, 
I know those two are different things, but one of them would kind of solve my problem.

However, it doesn't work for me in page titles. I suppose slashes and brackets (and other special characters) get "escaped". 
Reply
#5
As an alternative to a component you can use a custom field which you name custom-title for example, place the code
PHP Code:
<?php get_custom_field('custom-title'); ?>
in your template at the place where your title should be. In that field you can use <br> (html5) or <br /> . Best to make a seperate template file if you want to use this, but not in every page.

Although placing <br> (html5) or <br /> in the title without using custom fields is easyer and works fine as well.
Reply
#6
I am sure I have been unable to insert a break with an html  <br> tag. Or was that in the Site Title field? Is that set up differently to Page Title?
Reply
#7
(2015-06-24, 19:32:27)Timbow Wrote: I am sure I have been unable to insert a break with an html  <br> tag. Or was that in the Site Title field? Is that set up differently to Page Title?

You can't set a <br> or <br /> in the Website Name setting. Well you can, but it's ignored in the output.
Reply
#8
to: datiswous, Timbow > Thanks for the tip, guys. Workarounds with components/custom fields could work, but I'd like to stick to the core functionality of page titles mainly for the reason of i18n plugins mutual compatibility. It may get rather messy when trying to hack around stuff, especially on a multilingual website. 
Reply
#9
Haven't tried, but what about using \n and setting the heading's CSS to white-space: pre ?
Reply
#10
(2015-06-26, 23:16:52)Tyblitz Wrote: Haven't tried, but what about using \n and setting the heading's CSS to white-space: pre ?

Good idea, but all such attempts fail, because every special character in the title gets escaped. Including backslashes :/
No matter what character I put into the title, it won't affect its formatting. I suppose one of the reasons is security (data consistency).

I think we need a volunteer willing to make a plugin for this Smile
Reply
#11
Have you replaced <?php get_page_title(); ?> in your template by another function? (e.g. the one in Custom Title plugin, or other)

If you don't, GS currently still supports (uses) html in pages' titles. I've just tested this with a <br>
Reply
#12
(2015-06-27, 00:22:03)Carlos Wrote: Have you replaced <?php get_page_title(); ?> in your template by another function? (e.g. the one in Custom Title plugin, or other)

If you don't, GS currently still supports (uses) html in pages' titles. I've just tested this with a <br>

Ah, so that's why html isn't working for me. Yes, I'm using this: 
PHP Code:
return_i18n_page_data('about-us-box')->title 
Why? Because I need all page titles on home page and I need to be able to work with them separately. 


Thanks for pointing that out, Carlos.
Reply
#13
You could then use htmlspecialchars_decode(...)
Reply
#14
Code:
<?php get_custom_field('custom-title'); ?>

this one is not working for me can I use the default HTML code?
I am Web Developer at serverpk
Reply




Users browsing this thread: 1 Guest(s)