secret
Last active

  • Download Gist
gistfile1.txt
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172
<?php
/*
* The Loop for portfolio overview pages. Works in conjunction with the file template-portfolio.php and taxonomy-portfolio_entries.php
*/
 
 
 
global $avia_config;
$avia_config['avia_is_overview'] = true;
 
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 = "";
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='all_sort_button active_sort'>".__('All','avia_framework')."</a>";
$i = 'even';
foreach($categories as $category)
{
$output .= "<span class='text-sep ".$category->category_nicename."_sort_sep ".$i."'>/</span><a href='#'>category_nicename."_sort' class='".$category->category_nicename."_sort_button' >".$category->cat_name."</a>";
$container_id .= $category->term_id;
$i = 'odd';
}
$output .= "</div>";
$output .= "</div>";
echo $output;
}
}
//portfolio container
echo "<div class='ajax-portfolio-response-wrapper'>";
echo "<div class='ajax-control'><a href='#' class='ajax-close'><span>x</span></a><a href='#' class='ajax-next'><span>+</span></a><a href='#' class='ajax-prev'><span>-</span></a></div>";
echo "<div class='ajax-portfolio-response'></div>";
echo "</div>";
echo "<div class='portfolio-sort-container ".$avia_config['portfolio_hover']."'>";
//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 ';
}
}
if(!empty($avia_config['portfolio_ajax'])) $sort_classes .= " ajax_portfolio";
?>
 
<div data-ajax-id='<?php echo get_the_ID();?>' class='post-entry post-entry-<?php echo get_the_ID();?> flex_column all_sort no_margin <?php echo $sort_classes.' '.$grid.' '.$extraClass.' '.$style; ?>'>
<div class='inner-entry'>
<?php
echo "<h1 class='post-title portfolio-title'>";
echo "<span class='primary-background title-span'></span>";
echo "<a href='".get_permalink()."' rel='bookmark' title='".__('Permanent Link:','avia_framework')." ".get_the_title()."'>".get_the_title()."</a>";
echo "</h1>";
$forceSmall = true;
$slider = new avia_slideshow(get_the_ID());
$slider -> setImageSize($image_size);
if(!empty($avia_config['portfolio_ajax'])) $slider -> set_links(get_permalink());
echo $slider->display($forceSmall);
?>
</div>
<!-- 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;
unset($avia_config['avia_is_overview']);
?>

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.