Support » Fixing WordPress » 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. 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.