Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- * The Loop for portfolio overview pages. Works in conjunction with the file template-portfolio.php and taxonomy-portfolio_entries.php
- */
- global $avia_config, $wp_query;
- if(isset($avia_config['new_query'])) { query_posts($avia_config['new_query']); }
- $loop_counter = 1;
- // check if we got a page to display:
- if (have_posts()) :
- $extraClass = 'first';
- $style = 'portfolio-entry-no-description';
- $grid = 'one_fourth';
- $image_size = 'portfolio';
- switch($avia_config['portfolio_columns'])
- {
- case "1": $grid = 'fullwidth'; $image_size = 'fullsize'; break;
- case "2": $grid = 'one_half'; break;
- case "3": $grid = 'one_third'; break;
- case "4": $grid = 'one_fourth'; break;
- }
- $avia_config['portfolio_columns_iteration'] = $avia_config['portfolio_columns'][0];
- if(!isset($avia_config['remove_portfolio_text'])) $style = 'portfolio-entry-description';
- $includeArray = "";
- if(isset($avia_config['new_query']['tax_query'][0]['terms'])) $includeArray = $avia_config['new_query']['tax_query'][0]['terms'];
- $args = array(
- 'taxonomy' => 'portfolio_entries',
- 'hide_empty'=> 0,
- 'include' => $includeArray
- );
- $categories = get_categories($args);
- $container_id = "";
- $current_page_cats = array();
- while (have_posts()){
- the_post();
- $current_item_cats = get_the_terms( $id, 'portfolio_entries' );
- if(!empty($current_item_cats))
- {
- foreach($current_item_cats as $current_item_cat)
- {
- $current_page_cats[] = $current_item_cat->term_id;
- }
- }
- }
- $current_page_cats = array_unique($current_page_cats);
- if(!isset($avia_config['portfolio_sorting']) || $avia_config['portfolio_sorting'] == 'yes')
- {
- if(!empty($categories[0]))
- {
- $output = "<div id='js_sort_items' >";
- $hide = "hidden";
- if (isset($categories[1])){ $hide = ""; }
- $output .= "<div class='sort_by_cat $hide '>";
- $output .= "<a href='#' data-filter='all_sort' class='active_sort'>".__('All','avia_framework')."</a>";
- foreach($categories as $category)
- {
- if(in_array($category->term_id, $current_page_cats, true))
- {
- $output .= "<span class='text-sep'>/</span><a href='#' data-filter='".$category->category_nicename."_sort'>".$category->cat_name."</a>";
- $container_id .= $category->term_id;
- }
- }
- $output .= "</div>";
- $output .= "</div>";
- echo $output;
- }
- }
- echo "<div class='portfolio-sort-container'>";
- //iterate over the posts
- while (have_posts()) : the_post();
- //get the categories for each post and create a string that serves as classes so the javascript can sort by those classes
- $sort_classes = "";
- $item_categories = get_the_terms( $id, 'portfolio_entries' );
- if(is_object($item_categories) || is_array($item_categories))
- {
- foreach ($item_categories as $cat)
- {
- $sort_classes .= $cat->slug.'_sort ';
- }
- }
- ?>
- <div class='post-entry flex_column all_sort <?php echo $sort_classes.' '.$grid.' '.$extraClass.' '.$style; ?>'>
- <?php
- $forceSmall = true;
- $slider = new avia_slideshow(get_the_ID());
- $slider -> setImageSize($image_size);
- echo $slider->display($forceSmall);
- //$showcaption
- if(!isset($avia_config['remove_portfolio_text']))
- {
- echo '<div class="post-content">';
- echo "<h1 class='post-title'>";
- $slides = avia_post_meta(get_the_ID(), 'slideshow');
- if(!empty($slides[0])){
- $linktarget = avia_get_link($slides[0], 'slideshow_', '', get_the_ID());
- }
- if(empty($linktarget)){
- $linktarget = get_permalink();
- }
- echo "<a href='".$linktarget."' rel='bookmark' title='".__('Permanent Link:','avia_framework')." ".get_the_title()."'>". get_the_title()."</a>";
- echo "</h1>";
- echo '<div class="entry-content">';
- if($avia_config['portfolio_columns_iteration'] == 1)
- {
- echo '<span class="portfolio-categories minor-meta">';
- echo get_the_term_list( get_the_ID(), 'portfolio_entries', '<strong>'.__('Categories','avia_framework').': </strong><span>', '</span><span class="text-sep">/</span><span>','</span>');
- echo '</span>';
- }
- the_excerpt();
- echo '<a class="more-link" href="'.$linktarget.'">'.__('Read more →','avia_framework').'</a>';
- echo "</div>";
- echo "</div>";
- }
- else
- {
- $hr_class = 'hr hr_invisible';
- }
- ?>
- <!-- end post-entry-->
- </div>
- <?php
- $loop_counter++;
- $extraClass = "";
- if($loop_counter > $avia_config['portfolio_columns_iteration'])
- {
- $loop_counter = 1;
- $extraClass = 'first';
- }
- endwhile;
- echo "</div>"; // end portfolio-sort-container
- if(!isset($avia_config['remove_pagination'] ))
- {
- echo "<div class='hr hr_invisible'></div>";
- echo avia_pagination();
- }
- echo "<!-- end -->"; //dont remove
- else:
- ?>
- <div class="entry">
- <h1 class='post-title'><?php _e('Nothing Found', 'avia_framework'); ?></h1>
- <p><?php _e('Sorry, no posts matched your criteria', 'avia_framework'); ?></p>
- </div>
- <?php
- endif;
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement