• I’m trying to mess around with .php to do some customization, but I can’t figure out how to pull the post title into a .php string so that I can manipulate it.

    I can make is display with <?php wp_title….

    But how can I get the post title into a .php string?

Viewing 4 replies - 1 through 4 (of 4 total)
  • <?php
    $title=('This is the title');
    ?>

    <title><? print($title); ?></title>

    Should work ?
    Of course the next step – getting the title into each page – is very different as everything uses the same header.php where this is all set. On a page basis, it’s possible but a per-post basis could be long and complex.

    Thread Starter bmaples

    (@bmaples)

    Thanks.

    But I’m mot trying to change the <title> tag.

    I’m trying to get the wp-title into a string.

    Like
    $str=wp_title
    if $str … etc.

    But I can’t figure out how to get the wp_title into a string.

    try $title = wp_title(‘»’, false);

    Thread Starter bmaples

    (@bmaples)

    Thanks! That’s it.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Getting wp-title as a php string variable’ is closed to new replies.