简体   繁体   中英

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.

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.

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

<?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

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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