Support » Themes and Templates » how can this php have formatting applied?

  • Resolved csleh

    (@csleh)


    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?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Eric Amundson

    (@sewmyheadon)

    Volunteer Moderator

    Have you tried:

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

    ?

    Moderator Samuel Wood (Otto)

    (@otto42)

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

    csleh

    (@csleh)

    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.

    Moderator Samuel Wood (Otto)

    (@otto42)

    dot = string concatenation.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how can this php have formatting applied?’ is closed to new replies.