Hey guys, Looking for some help. On my wordpress blog which is running a London Live theme, at the bottom on the homepage it is showing "Other_news.php" which is a heading (Other News) which displays old blog posts. My problem is that its showing very old posts - 3 years or so, and I don't know how to change this. I think its setup to display posts from specific categories but I'm not sure how to edit these. Would really appreciate any help! I can paste the contents of Other_news.php below if it will help... You can take a look at the site here, its on the homepage at the bottom just before the footer: http://www.footyblog.net Thanks. Matt
Check this out: http://codex.wordpress.org/Class_Reference/WP_Query#Time_Parameters Add required date range as a parameter in the WP_Query('showposts=6&orderby=rand') function.
Thanks Imposter, was wondering if someone could help again... If I want to display posts from the previous 30 days, this is apparently the code: How do I go about adding it to this line: Wouldn't know how/where to add it... Thanks again
Try this: <?php $featured = new WP_Query('showposts=6&orderby=rand&monthnum=' . date('n', current_time('timestamp'))); while($featured ->have_posts()) : $featured->the_post(); ?> PHP: That should display posts published in the last month in a random order.
Thanks Imposter, I've tried this code but it doesn't seem to change anything - its still showing posts from a few years ago. I don't know about the code but is the fullstop needed before: date('n', ....
That's weird, I tried to put it in my theme and it worked for me. Yes. The full stop must be there to connect the string with the returned value of the date() function.
Ah okay.. well thanks for giving it a go. I was hoping there would just be an option somewhere within my theme but I can't seem to find anything