【问题标题】:how i can do featured post slider set category based?我怎么能做基于特色的帖子滑块集类别?
【发布时间】:2013-05-10 02:13:45
【问题描述】:

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

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

【问题讨论】:

  • 您可能想请一位真正会说英语的人来帮助您提出问题。你现在没有多大意义......
  • 谢谢……下次我会做的……

标签: html wordpress stylesheet


【解决方案1】:

如果我理解你的正确(困难 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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多