WordPress query on basis of variable date
-
Earlier M using this query to select a specific post and display in sidebar
$recent = new WP_Query('name=_______'); while($recent->have_posts()) : $recent->the_post();?>
By this I need to change name of post after few days to change the post in sidebar. What I want to do I to select three posts and display on date basis in sidebar
if($today>1 || $today <10) { $mypost = " "; } else if($today >10 || $today <20 {$mypost = " "; } else { $mypost = " "; }
& assign $mypost to query but when I add $mypost variable in this line Its not working…
$recent = new WP_Query('name=$mypost'); OR $myquery = "name=".$mypost; OR $recent = new WP_Query('$myquery'); OR $recent = new WP_Query('.$myquery.');
What is the proper way to use variable in WP Query
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘WordPress query on basis of variable date’ is closed to new replies.