Title: Slider with posts
Last modified: August 20, 2016

---

# Slider with posts

 *  [doubleF](https://wordpress.org/support/users/doublef/)
 * (@doublef)
 * [13 years, 6 months ago](https://wordpress.org/support/topic/slider-with-posts/)
 * Hi, I’m new on this forum ! 🙂
    I want to create for my theme a slider with all
   the latest projects (Exactly the same as in [this page](http://2f-design.fr/themes/sunrisingV2/index.html).
   I don’t understand how…Because I meet a serious problem: I need 12 thumbnails
   per slides so how to create a new slide for each 12 posts ? I try that, but FAIL….
 *     ```
       <div id="slider_latest" class="m1 rsDefaultInv">
                       <?php
                       $args = array(
                           'numberposts'     => 48,
                           'offset'          => 0,
                           'orderby'         => 'post_date',
                           'order'           => 'DESC',
                           'post_type'       => 'portfolio',
                           'post_status'     => 'publish' );
                       $total_posts = get_posts( $args );
                       $p=0;
                       for ( $i = 1; $i <= $total_posts; $i+=12 ) {
                           $output .= '<div class="rsImg">';
                           for ( $j = 1; $j <= 12; $j++ ) {
                                   $output .= '<div class="latest_block">';
                                   $image_id_full = get_post_thumbnail_id();
                                   $image_url_full = wp_get_attachment_image_src($image_id_full,'full');
                                   $image_url_full = $image_url_full[0];
                                   the_post_thumbnail('portfolio');
                                   $output .= '<div class="latest_over">';
                                       $output .= '<a href="'. $image_url_full .'" class="latest_over_picture" data-rel="prettyPhoto" title="'. the_title() .'" ></a>';
                                       $output .= '<a href="'. the_permalink() .'" class="latest_over_link"></a>';
                                   $output .= '</div><!-- end .latest_over -->';
                               $output .= '</div><!-- end .latest_block -->';
                           $p++;
                           if ( $p == $total_posts )
                               $p = 0;
                           }
                           $output .= '</div><!-- end .rsImg -->';
                       }
                       return $output;
                       wp_reset_query(); ?>
               </div><!-- end #slider_latest -->
       ```
   
 * (Included in any pages as a shortcode)
    **So in a few words, how to display 48
   posts in 4 slides with each one 12 posts ?** Can somebody help me 😛 Thanks !
 * F²

The topic ‘Slider with posts’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 0 replies
 * 1 participant
 * Last reply from: [doubleF](https://wordpress.org/support/users/doublef/)
 * Last activity: [13 years, 6 months ago](https://wordpress.org/support/topic/slider-with-posts/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
