April 15, 201511 yr I am trying to make a custom slider/swiper which shows every new post in each category with a featured image. There are only 5 categories I want images and latest posts to be shown. Here is my code for where I want the slider to be: <div class="swiper-container"> <div class="swiper-wrapper"> <div class="postimg-area_slide swiper-slide"> <a href="<?php the_permalink(); ?>"> <div class="postimg-area_slide--table"> <div class="postimg-area_slide--layout"> <div class="postimg-area_slide--overlay-title heading-secondary"><?php echo get_the_title();?></div> <div class="postimg-area_slide--overlay-date"><?php the_date(); ?></div> </div> </div> </a> <div class="promo-area_slide--details"> <div class="postimg-area_slide--title"><?php echo get_the_title();?></div> <div class="postimg-area_slide--date"><?php the_date(); ?></div> <div class="postimg-area_slide--categories"><?php get_the_category( $post_id ); ?></div> </div> <img <?php has_post_thumbnail('slide-thumb'); ?>> </div> </div> And here is what I have in my function.php file: $args = array( 'posts_per_page' => 5, 'post_type' => 'post', 'post_status' => 'publish', 'category_name' => 'Technology', 'Style', 'orderby' => 'date', 'order' => 'DESC', ); I'm new to all this. Anyone able to tell me where I'm going wrong?
April 20, 201511 yr Theres a JavaScript library called hammer.js which is a small lib that allows you to perform swipe interactions quite easily. http://hammerjs.github.io/
April 20, 201511 yr Author Thanks @@Matthew Claffey and @@rbrtsmith for that. I have the whole design of the swiper ready. The I am just having trouble implementing it to WordPress.
April 21, 201511 yr So what you really need is to customise the loop so that you are getting one post from each category. You need to start by creating a loop using WP Query Have look at that link there under category Parameters and there should be some examples to get you started. From there it is just a question of using the right markup for your slider. Good Luck!
Create an account or sign in to comment