Wordpress show posts that start today and end in one year
I would like to know some way to do this, maybe someone ca开发者_StackOverflow社区n help me out a little bit! This is the code i have at the moment:
<?php $featured = new WP_Query('showposts=10&cat=23'); while($featured ->have_posts()) : $featured->the_post(); ?>
<?php if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) { ?>
<?php $image_id = get_post_thumbnail_id(); $image_url = wp_get_attachment_image_src($image_id,'large'); $image_url = $image_url[0]; ?>
<?php $blogurl = get_bloginfo('url'); $image_url = str_replace($blogurl, '', $image_url); ?>
So straight forward question is how can i display posts that start today and end in one year, from a specific category Thanks!
See the Time Parameters section in the WordPress Codex page for WP Query
, the part about filters should prove useful. Alternatively, see this post on how to hide content based on age of post in WordPress.
精彩评论