How to add a line break in a post title
-
Hello,
I have a very long title for one of my post and I would like to add a line break between the two parts.
If I use <br/> in the title of my WP post, nothing happens.
I have found that I could insert a vertical pipe ??|?? in my title and use this code:
<?php echo str_replace(' | ', '<br />', get_the_title()); ?>
But I don’t know exactly where to insert it. When I insert it in my content.php file, a second title appears (with a line break proving that the short code works).
If I try to insert it in this part:
<?php if (! is_single() ) {
the_title( sprintf( ‘<h2 class=”entry-title”>‘, esc_url( get_permalink() ) ), ‘</h2>’ );
} else {
the_title( ‘<h2 class=”entry-title”>’, ‘</h2>’ );
} ?>
it breaks my post.I have searched on the Toujours template support but couldn’t find a solution.
Is there a way to insert a line break without adding a new plugin?
- The topic ‘How to add a line break in a post title’ is closed to new replies.