Forums

Styling text adds extra line breaks (6 posts)

  1. celerymax
    Member
    Posted 6 months ago #

    Hello,

    I'm currently trying to have a line display on my site that reads:
    Contributed by (post author) on (post date)

    I have the following code:
    <p class=italic>Contributed by</p> <?php the_author()?> <p class=italic>on</p> <?php the_date()?>

    It's correctly calling the correct author and date information. However, I'm having trouble with the italics. When I style the text using <p>, wordpress automatically adds in <br />s to make it a paragraph. So what I'm actually getting on my site looks like this:

    Contributed by
    (post author)
    on
    (post date)

    How do I get rid of the extra line breaks so that all of that text displays on one line?

    Thanks,
    Ben

  2. alchymyth
    The Sweeper
    Posted 6 months ago #

  3. celerymax
    Member
    Posted 6 months ago #

    Of course. *facepalm* Thanks much alchymyth!

  4. rachelbaker
    Member
    Posted 6 months ago #

    I would use just one paragraph element and add italics with the <em> tag:

    <p><em>Contributed by</em> <?php the_author()?> <em>on</em> <?php the_date()?></p>

  5. celerymax
    Member
    Posted 6 months ago #

    I opted not to use the <em> tag because I want to keep all my text styling consistent throughout and use css classes. But that's also a great suggestion!

  6. rachelbaker
    Member
    Posted 6 months ago #

    Glad you resolved your issue.

Reply

You must log in to post.

About this Topic

Tags