I am using a wordpress post to display testimonials, using the post content as the testimonial itself and its title for displaying the person giving the testimonial, and his company. In order to separate the name of the person from his company name and thus style them differently, I used the following code:
< ?php
$title = $post->post_title;
$namecompany = explode("-", $title);
echo ($namecompany[0].' - '); ?>
< ?php echo ($namecompany[1]); ?>
As you can see, we are using the $post->post_title variable which contains the title of the post, and then using the PHP function explode to break up the title into two parts based on the dash separator.
Related posts:

Web professional in Malta, Europe. Focusing on building visually stunning websites that are easy to maintain, usually using WordPress as the CMS. Web developing since 1995, loving WordPress for more than 5 years.
Hello,
I am working on site in wordpress, where all the Jobs are pulled from the external jobs sites, such as monster, indeed, simplyhired. jobs are getting published on site randomly. but I need to explode the jobs titles after specific ascii character ” – ” for ex Sales and Marketing Manager – Mortons Steakhouse – San Francisco, CA and extract last jobs Address from the title and call it in location column.
Can somebody give me php function or other way for this, the ” – ” is common for all jobs titles published on site.
please help waiting….
Thanks