0

How can I show maximum 8 portfolio items on tabs and previous/next buttons? Now on my portfolio all tab shows 8 portfolio items(see the first picture) but I have a problem with previous/next buttons and for other tab(for example javascript, see the second picture it shows only 3 items (not all). How can I solve these problems? I attached the code. I will appreciate any help.

<?php
                 $terms = get_terms("tagportifolio");
                 $count = count($terms);
                 echo '<ul id="portfolio-filter">';
                    echo '<li><a href="#all" title="" class="portfolio-tab">All</a></li>';
                 if ( $count > 0 ){

                        foreach ( $terms as $term ) {

                            $termname = strtolower($term->name);
                            $termname = str_replace(' ', '-', $termname);
                            echo '<li><a href="#'.$termname.'" title="" rel="'.$termname.'" class="portfolio-tab">'.$term->name.'</a></li>';
                        }
                 }
                 echo "</ul>";
            ?>


            <?php 

            $args = array(
            'post_type' => 'project',
'posts_per_page' => 8,

);

$loop = new WP_Query( $args ); 
            $count =0;
                //$loop = new WP_Query(array('post_type' => 'project', 'posts_per_page' => 8));
                //$count =0;
            ?>

            <div id="portfolio-wrapper">
                <ul id="portfolio-list">

                <?php if ( $loop ) : 

                    while ( $loop->have_posts() ) : $loop->the_post(); ?>

                        <?php
                        $terms = get_the_terms( $post->ID, 'tagportifolio' );

                        if ( $terms && ! is_wp_error( $terms ) ) : 
                            $links = array();

                            foreach ( $terms as $term ) 
                            {
                                $links[] = $term->name;
                            }
                            $links = str_replace(' ', '-', $links); 
                            $tax = join( " ", $links );     
                        else :  
                            $tax = '';  
                        endif;
                        ?>

                        <?php $infos = get_post_custom_values('_url'); ?>

                        <li class="portfolio-item <?php echo strtolower($tax); ?> all col-md-3 col-sm-3">
                        <figure class="figure-portfolio">
  <a href="<?php the_permalink() ?>"><?php the_post_thumbnail( array(400, 160) ); ?></a>
  <figcaption>
  <!-- Button trigger modal -->
  <div class="caption-portfolio">
  <h5 class="portfolio-title"><a href="<?php the_permalink(); ?>" target="_blank"><?php the_title(); ?></a></h5>
<a href="<?php the_permalink(); ?>" target="_blank"><i class="fa fa-search btn btn-info"></i></a>
<a href="<?php echo get_post_meta($post->ID,'_url',TRUE); ?>" target="_blank"><i class="fa fa-link btn btn-danger"></i></a>
</div>

 </figcaption>
</figure>
                                </li>

                    <?php endwhile; else: ?>

                    <li class="error-not-found">Sorry, no portfolio entries for while.</li>

                <?php endif; ?>


                </ul>
                <div class="clearboth"></div>
                <?php previous_post_link(); ?> | <?php next_post_link(); ?>
                <div class="clearboth"></div>

ALL TAB PORTFOLIO FIRST PICTURE

JAVASCRIPT TAB

SECOND PICTURE

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.