• 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?

Viewing 1 replies (of 1 total)
  • Hi there,

    I’m afraid we don’t provide support for PHP customizations to our themes.

    However, we’ll leave this thread open, in case anyone else from the community is able to help you with this.

Viewing 1 replies (of 1 total)
  • The topic ‘How to add a line break in a post title’ is closed to new replies.