Display all posts with the same title
-
This should be easy and I don’t know if I’m having a moment or overthinking it – but I post a whole lot of events using their date as the title like 25th Wednesday 2011 – just in diff. categories.
Of course when posted only the first gets that slug – the rest get appended with -1, -2, -3 etc.
So I wanted to display all the posts with todays title in the sidebar.
<?php $today = date ("l jS F Y"); ?> <?php $daysracing = new WP_Query("name=$today&posts_per_page=-1"); while($daysracing->have_posts()) : $daysracing->the_post(); $category = get_the_category(); ?>
But of course because name works on the slug this is only showing the first post not the ones appended -1 and -2 etc.
I can’t find a way to query the actual post title – so how do I get around this?
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Display all posts with the same title’ is closed to new replies.