简体   繁体   English

PHP滑块基于Wordpress中活动类别的当前帖子

[英]PHP slider based on current posts from active category in Wordpress

Hello fellow community, 大家好,

I'm pulling my hair off for the past 3 days. 在过去的三天里,我一直在扯头发。

I tried many post / gallery / sliders plugins on Wordpress, and I cannot get the result I was looking for. 我在Wordpress上尝试了许多post / gallery / slider插件,但无法获得所需的结果。

Basicaly what I would like to do is to generate a dynamic slider based on the current posts from the active category page. 基本上,我想做的是基于活动类别页面上的当前帖子生成一个动态滑块。 The posts are all listed under the same category. 这些帖子都列在同一类别下。 The slider must display ONLY the posts belonging to the current category. 滑块必须仅显示属于当前类别的帖子。

I tried to customize the category.php page with Slider Revolution but it only retrieve "the most recent" post and not the rest. 我尝试使用Slider Revolution自定义category.php页面,但它仅检索“最新”帖子,而不检索其余帖子。

I tried with many others plugins but they all display posts from other categories. 我尝试了许多其他插件,但它们都显示其他类别的帖子。

Thank you very much for your help. 非常感谢您的帮助。

So a bxslider could look something like this 所以bxslider可能看起来像这样

<?php 
if ( have_posts() ) : ?>
    <div class="bxslider">
      <?php while ( have_posts() ) : ?>
           <?php the_post();?> 
            <div class="whateverClassHere">whatever content here <?php echo get_the_title(); ?></div>
      <?php endwhile; ?> 
   </div>
<?php endif; ?>

And then you would initiate it with Jquery 然后用Jquery初始化它

$('.bxslider').bxslider(); //read the docs for settings here.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM