You want to have some individual styling for whatever reason and you need a to get the first word from a WordPress title and display it as a class. Easy. Let’s do it:
Here’s your DIV before
Code to Extract First Word of Title and Display It
Have a page template that is shared among a group of pages? Spiff up that page template by adding individualized classes/ids to your WordPress pages.
Cody By Itself
This bit of code can be used for a bit more than simply adding classes depending on your need.
What this code is doing is grabbing the title, exploding it into an array and then taking the first value of the title array and echoing the string out as lowercase.