Parse Post Title
-
I have a set of posts with titles like this:
20071121 November 21, 2007
I’d like to strip out the numeric date (used for sorting) and leave the date in words. The date shows up with the numbers but I don’t even think that it has even gotten to the point where I attempt to reformat it.
Code
$postslist = get_posts('numberposts=10&order=ASC&orderby=post_title'); foreach ($postslist as $post) : setup_postdata($post); $mypost_title = the_title(); $datewords = preg_split("/[\s]+/", $mypost_title); echo $datewords[1] . " " . $datewords[2] . " " . $datewords[3]; the_excerpt(); echo "<br />"; endforeach;Output:
http://test1.handcraftedsites.com/index.php
Thank you for your help!
Elizabeth
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Parse Post Title’ is closed to new replies.