我怎么能做基于特色的帖子滑块集类别?

时间:2013-05-10 02:13:45

标签: html wordpress stylesheet

我的精选帖子滑块设置为标签。我想要它设置类别基础。我怎么做?我的网站http://techgajot.com 我的精选帖子滑块HTML代码?

<script type="text/javascript">
//<![CDATA[
    jQuery(window).load(function() {
        jQuery('#featured').flexslider({
            slideshowSpeed: 6000,
            directionNav:false,
            pauseOnHover:true,
            manualControls: '.flexslide-custom-controls li a',
            controlsContainer: '.container'
        });

    });
//]]>
</script>

<div class="featured">

    <div class="container">

        <div id="featured" class="flexslider">

            <ul class="slides">

<?php 
$count = 1;
$featurecount = get_option('solostream_features_number'); 
$my_query = new WP_Query("tag=featured&showposts=$featurecount");
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>

                    <li id="narrow-feature-post-<?php echo $count; ?>"<?php echo solostream_featureclass(); ?>>

                    <div class="slide-container clearfix">

                        <?php if ( get_post_meta( $post->ID, 'video_embed', true ) ) { ?>
                            <div class="feature-video">
                                <div class="video"><?php echo get_post_meta( $post->ID, 'video_embed', true ); ?></div>
                            </div>
                        <?php } else { ?>
                            <div class="feature-image"> 
                                <a href="<?php the_permalink() ?>" rel="<?php _e("bookmark", "solostream"); ?>" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php solostream_feature_image(); ?></a>
                            </div>
                        <?php } ?>

                            <div class="flex-caption">
                            <div class="excerpt">
                                <h2 class="post-title"><a href="<?php the_permalink() ?>" rel="nofollow" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php the_title(); ?></a></h2>
                                <?php if ( 'post' == get_post_type() ) { ?>
                                    <?php include (TEMPLATEPATH . "/postinfo.php"); ?>
                                <?php } ?>
                                <?php the_excerpt(); ?>
                                <p class="readmore"><a class="more-link" href="<?php the_permalink() ?>" rel="nofollow" title="<?php _e("Permanent Link to", "solostream"); ?> <?php the_title(); ?>"><?php _e("সম্পূর্ন অংশ", "solostream"); ?></a></p>
                            </div>
                        </div>

                    </div>

                </li>

<?php $count = $count + 1 ?>
<?php endwhile; ?>

            </ul>


        </div>

        <div class="controls-container clearfix">

            <ul class="flexslide-custom-controls clearfix">

<?php 
$count = 1;
$featurecount = get_option('solostream_features_number'); 
$my_query = new WP_Query("tag=featured&showposts=$featurecount");
while ($my_query->have_posts()) : $my_query->the_post();
$do_not_duplicate[] = $post->ID; ?>

                <li><a href="#" title="<?php the_title(); ?>"><?php echo $count; ?></a></li>

<?php $count = $count + 1 ?>
<?php endwhile; ?>

            </ul>

        </div>

    </div>

</div>

我该怎么做。我的精选帖子滑块标签现在=特色。当我把“精选”任何帖子标签选项,然后它显示特色帖子。现在我想要它类别基础。我在这里选择任何类别。然后该类别所有帖子显示精选帖子。

1 个答案:

答案 0 :(得分:0)

如果我理解你的话(困难ike @dda注意到)改变这一行:

$my_query = new WP_Query("tag=featured&showposts=$featurecount");

$my_query = new WP_Query("category_name=featured&showposts=$featurecount");

将使用名称从标签到类别进行相同的查询。

如果您使用ID,那么

$query = new WP_Query( 'cat=2,7,23,35' );

或所有分享此类别的帖子:

$query = new WP_Query( 'category_name=staff' );

了解更多HERE ON THE CODEX