我想显示post_status =“trash”的帖子,但不显示post_status =“publish”的帖子。简而言之,垃圾箱中的帖子应该显示在网站上。垃圾桶可以在垃圾桶中使用多长时间?任何帮助,将不胜感激。
index.php
<?php
// show all coupons and setup pagination
$paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
query_posts(array(
'post_type' => APP_POST_TYPE,
'ignore_sticky_posts' => 1,
'paged' => $paged
));
?>
<?php get_template_part('loop', 'coupon'); ?>
环coupon.php
<?php while (have_posts()) : the_post(); ?>
<?php appthemes_before_post(); ?>
<div <?php post_class('item'); ?> id="post-<?php echo $post->ID; ?>">
<div class="item-holder">
<div class="item-frame">
<div class="store-holder">
<div class="store-image">
<a href="<?php echo appthemes_get_custom_taxonomy($post->ID, APP_TAX_STORE, 'slug'); ?>"><img height="89" width="110" src="<?php echo clpr_store_image($post->ID, APP_TAX_STORE, 'term_id', '110', null); ?>" alt="" /></a>
</div>
<div class="store-name">
<?php echo get_the_term_list($post->ID, APP_TAX_STORE, ' ', ', ', ''); ?>
</div>
</div>
<?php clpr_vote_box_badge($post->ID, $the_trans); ?>
<div class="item-panel">
<?php clpr_coupon_code_box(); ?>
<div class="clear"></div>
<?php appthemes_before_post_title(); ?>
<h1><a href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'View the "%s" coupon page', 'appthemes' ), the_title_attribute( 'echo=0' ) ); ?>"><?php if (mb_strlen(get_the_title()) >= 87) echo mb_substr(get_the_title(), 0, 87).'...'; else the_title(); ?></a></h1>
<?php appthemes_after_post_title(); ?>
<?php appthemes_before_post_content(); ?>
<p class="desc"><?php echo mb_substr(strip_tags($post->post_content), 0, 200).'... ';?><a class="more" href="<?php the_permalink(); ?>" title="<?php printf( esc_attr__( 'View the %s coupon page', 'appthemes' ), the_title_attribute( 'echo=0' ) ); ?>"><?php _e('more ››', 'appthemes') ?></a></p>
<?php appthemes_after_post_content(); ?>
</div> <!-- #item-panel -->
</div> <!-- #item-frame -->
</div>
</div>
<?php appthemes_after_post(); ?>
<?php appthemes_after_endwhile(); ?>
<?php appthemes_loop_else(); ?>
<h3><?php _e('Sorry, no coupons found', 'appthemes'); ?></h3>
`
答案 0 :(得分:1)
尝试在循环之前添加此
query_posts($query_string. '&post_status=trash');