Hello nikosites,
You can add this before The Loop.
<?php
function filter_where($where = '') {
//specific date range for year 2011
$where .= " AND post_date > '" . date('Y-m-d', strtotime('2011-01-01')) . "'";
$where .= " AND post_date < '" . date('Y-m-d', strtotime('2011-12-31')) . "'";
return $where;
}
add_filter('posts_where', 'filter_where');
query_posts($query_string);
?>
Then after the loop put this code:
<?php remove_filter('posts_where', 'filter_where'); ?>
to avoid problem on another loop.
Look for php’s strtotime for other valid parameter. 🙂
Let me know if that helps.
Best Regards,
Calvin
Thread Starter
Niko
(@nikosites)
Thanks Kalvin
I could not finde the exact place, where to place the code…
I tried it on loop.php and loop-page.php of my active theme, but….
I’d like to know which page needs to take that code. I use to work with wordpress and modify it, but not the PHP part. (I know PHP, but not a core professional 🙂
I tried to find where the created (by user) pages reside, but it does not work like this – I think. they must be dynamic.
I created four pages (2011 to 2014) to archive and close the posts of these years and display them on these 4 pages separately by year, but could not resolve that task till not.
That’s because I posted to find the tips.
thanks…
Hello nikosites,
What theme are you currently using? You can create a template page for each year but that is not the best way to go. I also suggest you learn how metabox works. http://codex.wordpress.org/Function_Reference/add_meta_box
Using metabox, you can just insert year then it will dynamically query depends on the year your input.
Best Regards,
Calvin
Thread Starter
Niko
(@nikosites)
Hi Calvin
Thanks for trying to help.
My actual theme is “purple pastels”.
I will check and learn about metabox and post back here the result.
thank you…
Thread Starter
Niko
(@nikosites)
Thanks Calvin.
I found different solution, because the way I wanted to do, it could take a lot of time and work digging inside de code.
I could not find the plugin for this (maybe in future someone will create the plugin)
I have just created a new page for the next year posts, closed the posts for the actual 2014 page and placed it under the “archived posts” page as sub menu.
Case resolved.
Merry christmas…
Hi
I am using wordpress realto theme & bottom of the page there is 3 slider, for that slider i made 3 category for property show that is pre-lunch property, Under construction & ready to move, so in that slider all slide move at time but how can i make it each slide will slide itself.
Finally need all property will show different slide, it means 1st slide pre-launch. 2nd slide under construction, 3rd page ready to move. this will show all different page slide if upload randomly