0

我的特色帖子滑块设置为标签。我希望它设置类别基础。我该怎么做?我的网站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>

我怎么能做到。我的精选帖子滑块标签现在=精选。当我输入“精选”任何帖子标签选项时,它会显示精选帖子。现在我想要它像类别基础。我在这里选择任何类别。然后该类别所有帖子都显示精选帖子。

4

1 回答 1

0

如果我理解你的正确(困难 ike @dda 指出)改变这一行:

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

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

将使用 name ..从标签到类别进行相同的查询

如果您使用 ID ,那么

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

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

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

阅读更多关于食典的信息

于 2013-05-10T07:01:36.687 回答