webmasters
webmasters

Reputation: 5831

Put wordpress title inside variable

Any idea how to make this work?

$title = wp_title();

The problem is wordpress automatically echoes the wp_title();

Any ideas?

Upvotes: 1

Views: 1859

Answers (2)

cdhowie
cdhowie

Reputation: 168998

$title = wp_title('', 0);

Upvotes: 2

Jakub
Jakub

Reputation: 20475

Have you even looked @ the Wordpress documentation? Its right here: http://codex.wordpress.org/Function_Reference/wp_title

use it like so:

<?php wp_title( $sep, $echo, $seplocation ); ?>

where $echo is boolean (true/false)

$echo (boolean) (optional) Echo the title (True) or return the title for use as a PHP string (False).

    Default: True 

    * 1 (True) - default
    * 0 (False) 

Upvotes: 7

Related Questions