the_title() not spliting
-
Hey all,
I am trying to split the name of a Post Title in to individual words (E.g. ‘John Smith’ would become ‘[0] => John, [1] => Smith’), but no matter what method I use (See below) the space in the tile is not being picked up and the each instance of $firstName is returning the whole Post Title.
Any help or pointers appriciated.
Thanks.
list($firstName, $surName) = split(" ", the_title(), 2); echo $firstName . '<br />'; $str = the_title(); list($firstName, $surName) = split(" ", $str, 2); echo $firstName . '<br />'; $firstName = explode(" ",the_title()); $firstName = $firstName[0]; echo $firstName . '<br />'; $firstName = the_title(); $firstName = explode(" ", $firstName); $firstName = $firstName[0]; echo $firstName . '<br />';
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘the_title() not spliting’ is closed to new replies.