WordPress.org

Ready to get started?Download WordPress

Forums

add break to post title? (4 posts)

  1. designingdani
    Member
    Posted 4 years ago #

    I am using the wordpress theme "Headlines" by woothemes, and I am trying to add a break in a post title so that I can get it on 2 lines.
    url:
    http://uwmag.com/wordpress1/?cat=4

    I want the name and position title on separate lines. I tried to set a fixed width to it, but it made my slider titles on homepage completely disappear, and yielded funky results with weird word groupings like...

    Jessie
    Kreich-Higdon
    Photographer

    and

    Alison Teracio, Om
    Columnist

    ....So, is there any other way to add a break to a post title without setting a fixed width?

  2. Only way I've figured this out in the past is to limit the post title and then add the extra info in custom fields and have them display under the title. The calls to the custom field data would go in the page template. If there was no data in a custom field, nothing would print.

    So you'd only have the name as the post title, and then add "Publisher" or "Designer" or other info in a custom field. That custom field would print with either the same CSS style or a different style, on lines below the post title. And the custom fields not be links in the way the post title is a permalink.

  3. alchymyth
    Forum Moderator
    Posted 4 years ago #

    if you always (or at least on the category 4 page) want to do this, 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.

    ( if this is only for category 4, make a copy of category.php - or what ever displays this page - and save it under the name category-4.php; then edit 'the_title();' )

  4. @alchymyth, good idea. Kind of like a custom field built into the_title.

Topic Closed

This topic has been closed to new replies.

About this Topic