在Wordpress帖子标题中添加换行符
I have long post titles in my wordpress website.
what I would like to do, is insert a line break so that the post title take up 2 lines.
I have been able to achieve this by using < b r > (no spaces) within my post title.
The problem is now, that wordpress is duplicating my post title "background" image for the second line. So now there are two "rectangles" underneath each other - each with a line of text.
How could I prevent the post title image from duplicating, and keep both lines of text within the one rectangular post title image?
Thank you
我的wordpress网站上有很长的帖子。 p>
我想做的是插入一个换行符,以便帖子标题占用2行。 p>
我已经能够通过使用&lt; b r> 我的帖子标题中没有空格。 p>
现在的问题是,wordpress正在复制第二行的帖子标题“背景”图像。 所以现在彼此之下有两个“矩形” - 每个都有一行文字。 p>
如何防止帖子标题图像重复,并将两行文本保留在一个矩形帖子标题图像中? p>
谢谢 div>
keep your code which prints title in a single div.apply background image to this div only. then inside this div use as many < br >, the image should not breakup.
Add a comma in title and you could try to replace:
`<?php the_title(); ?>`
with:
`<?php echo str_replace(',','<br />',get_the_title()); ?>`
this replaces a comma , in the title with a html linebreak.
it's a logic try on yourself.