我有一个主滑块和新闻部分的主页。
主滑块通过tag=\'slider\'获取帖子,并显示10个帖子限制。
各部分按类别获取帖子(每个部分按特定类别)
我想做的是:从部分中排除在滑块中显示的帖子,直到帖子退出滑块。
以下是滑块的代码和部分示例:
Slider Code :
<?php
// Slider
$tag = ap_option(\'slider_tag\');
$count = ap_option(\'slider_count\');
$slid = new WP_Query(
array(
\'tag\' => $tag ,
\'posts_per_page\' => $count ,
\'post__not_in\' => get_option( \'sticky_posts\' ),
)
);
?>
<div class="thumbslider">
<div class="postlist">
<?php while ( $slid->have_posts() ) : $slid->the_post(); ?>
<div class="item">
<div class="det">
<h2><a href="<?php the_permalink() ?>" title="<?php the_title();?>"><?php
the_title(); ?></a></h2>
</div>
<div class="thumbnail">
<a href="<?php the_permalink() ?>" title="<?php the_title();?>">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail( \'slider\' );
} else {
echo \'<img alt="Assahifa.com" title="Assahifa.com" src="https://placeholdit.imgix.net/~text?txtsize=20&bg=eee&txtclr=8C8C8C%26text%3Dthree&txt=ap&w=650&h=420">\';
}
?>
</a>
</div>
</div>
<?php endwhile;wp_reset_postdata(); ?>
</div>
</div>
Section News Sample : <?php
// cat eco
$n=0;
$cat_eco = ap_option(\'sec_eco_cat\');
$count_eco = ap_option(\'sec_eco_count\');
$eco = new WP_Query(
array(
\'cat\' => $cat_eco ,
\'posts_per_page\' => $count_eco ,
\'post__not_in\' => get_option( \'sticky_posts\' ),
\'offset\' => 0,
)
);
?>
<section class="main_eco clearfix">
<div class="box">
<div class="title" style="color: <?php echo ap_option(\'eco-color\'); ?>;">
<h3 style="color: <?php echo ap_option(\'eco-color\'); ?>;"><a href="<?php
echo get_category_link( $cat_eco ); ?>" title="<?php echo
ap_option(\'sec_eco_title\'); ?>" style="color: <?php echo ap_option(\'eco-
color\'); ?>;"><?php echo ap_option(\'sec_eco_title\'); ?></a></h3></div>
<div class="postlist">
<?php while ( $eco->have_posts() ) : $eco->the_post();$n++; ?>
<div class="item clearfix">
<div class="thumbnail imgtrans">
<a href="<?php the_permalink() ?>" title="<?php the_title();?>">
<?php
if ( has_post_thumbnail() ) {
the_post_thumbnail( \'md\' );
} else {
echo \'<img alt="AisPanel" title="AisPanel"
src="https://placeholdit.imgix.net/~text?
txtsize=20&bg=eee&txtclr=8C8C8C%26text%3Dthree&txt=ap&w=650&h=420">\';
}
?>
</a>
</div>
<div class="det">
<h2><a href="<?php the_permalink() ?>" title="<?php the_title();?
>"><?php the_title(); ?></a></h2>
<!--<?php if($n == 1) the_excerpt(); ?>-->
</div>
</div>
<?php endwhile;wp_reset_postdata(); ?>
</div>
</div>
</section>