0

我想显示 post_status="trash" 但不显示 post_status="publish" 的帖子。简而言之,垃圾箱中的帖子应该显示在网站上。垃圾帖可以在垃圾箱中保留多长时间?任何帮助,将不胜感激。

索引.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');  ?>

循环优惠券.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 &rsaquo;&rsaquo;', '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>

`

4

1 回答 1

1

尝试在循环之前添加它

query_posts($query_string. '&post_status=trash');
于 2013-08-17T16:12:17.920 回答