Skip to content
View in the app

A better way to browse. Learn more.

Web Designer Forum

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Help with custom slider

Featured Replies

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?

 

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

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.