[resolved] how can this php have formatting applied? (5 posts)

  1. csleh
    Posted 7 years ago #

    I have a line above the loop to show the page title for breadcrumbs. It looks like this and works well:

    echo wp_title();

    but I need to add a <p> tag so I can control the formatting. Have tried many things but it breaks the site. My most recent attempt is this:
    echo '<p><?php wp_title(); ?></p>';

    but the title doesn't display.

    any ideas?

  2. Eric Amundson
    Volunteer Moderator
    Posted 7 years ago #

    Have you tried:

    <p><?php wp_title(); ?></p>


  3. Also:
    echo '<p>'.wp_title().'</p>';

  4. csleh
    Posted 7 years ago #

    Cool! The second one works. Will mark as resolved.

    Question though:
    it looks like this is echoing to fill in the <p> tag, the getting the title, then echoing the </p>. What does the "." do?

    thanks for the quick response too.

  5. dot = string concatenation.

Topic Closed

This topic has been closed to new replies.

About this Topic