title: Get first word in string php the_title WordPress
body: <p>I'm trying to shorten a wordpress title to just the first word. For a page named "John Doe" I want to have a sub title somewhere on the page that says "About John" so I want to just get the first word from the title.</p>
  
  <p>Is there a way to do this with PHP?</p>
  
  <p>Thanks!</p>
  
  <p><strong>UPDATE:</strong><br>
  Thanks for your answers! I tried the following code but it doesn't seem to be working. It still echoes the full title. Any suggestions?</p>
  
  <pre><code>&lt;?php   
     $title = the_title();
     $names = explode(' ', $title);
     echo $names[0];
  ?&gt;
  </code></pre>