Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /*
- Template Name: Portfolio
- */
- global $data;
- function chs($string)
- {
- return preg_replace('~&([a-z]{1,2})(acute|cedil|circ|grave|lig|orn|ring|slash|th|tilde|uml);~i', '$1', htmlentities($string, ENT_QUOTES, 'UTF-8'));
- }
- ?>
- <?php get_header(); ?>
- <section class="page-title">
- <div class="double-separator"></div>
- <div class="breadcrumbs">
- <div class="one-third align-left">
- <?php if (function_exists('dt_breadcrumbs')) dt_breadcrumbs(); ?>
- </div>
- <div class="two-third column-last align-right">
- <?php
- $categs = get_post_meta($post->ID,'haze_cats_field');
- $layout = get_post_meta($post->ID,'haze_portfolio_columns',true);
- $navig = get_post_meta($post->ID,'haze_portfolio_navigation',true);
- $nav_number = get_post_meta($post->ID,'haze_nav_number',true);
- $i=0;
- $count =0;
- $term_list ='';
- $list = '';
- foreach ($categs as $categ) {
- $i++;
- $to_replace = array(' ', '/', '&');
- $intermediate_replace = strtolower(str_replace($to_replace, '-', $categ));
- $str = preg_replace('/--+/', '-', $intermediate_replace);
- $str=chs($str); echo $str;
- $term_list .= '<li class=""><a href="#" data-value="'. $str .'" class="dt-'. $str .'">' . $categ . '</a></li>';
- $list .= $categ . ', ';
- if ($count != $i)
- {
- $term_list .= '';
- }
- else
- {
- $term_list .= '';
- }
- }
- if (($i > 1) && ($navig == 'filter')) { ?>
- <ul id="filters">
- <li><?php _e('Sort By: ', 'haze'); ?></li>
- <li class="selected active"><a data-value="all" href="#">All</a></li>
- <?php
- echo $term_list; ?>
- </ul>
- <?php
- }
- else if (($i = 1) && ($navig == 'filter')) { ?>
- <ul id="filters">
- <?php
- echo $categ; ?>
- </ul>
- <?php
- }
- ?>
- </div>
- </div><!--end breadcrumbs-->
- <div class="double-separator"></div>
- </section>
- </div><!--end top-->
- <div class="centered-wrapper">
- <section id="portfolio-wrapper">
- <ul class="portfolio <?php echo $layout; ?>">
- <?php
- $show_number = '-1';
- if ($navig == 'no-filter') {
- if (!empty($nav_number)) {
- $show_number = $nav_number;
- }
- else $show_number = 8;
- }
- //get post type - portfolio
- query_posts(array(
- 'post_type'=>'portfolio',
- 'posts_per_page' => $show_number,
- 'term' => 'portfolio_cats',
- 'portfolio_cats' => $list,
- 'paged'=>$paged
- ));
- // Begin The Loop
- if (have_posts()) : while (have_posts()) : the_post();
- // Get The Taxonomy 'Filter' Categories
- $terms = get_the_terms( get_the_ID(), 'portfolio_cats' );
- //Apply a data-id for unique indentity,
- //and loop through the taxonomy and assign the terms to the portfolio item
- // which will be referenced to Quicksand
- ?>
- <li data-id="id-<?php echo $count; ?>" class="portfo <?php if($terms) { foreach ($terms as $term) {
- $new_to_replace = array(' ', '/', '&');
- $new_intermediate_replace = strtolower(str_replace($new_to_replace, '-', $term->name));
- $new_str = preg_replace('/--+/', '-', $new_intermediate_replace);
- $new_str=chs($new_str);
- echo $new_str .' ';
- } } else { echo 'none'; } ?>">
- <?php
- // Check if wordpress supports featured images, and if so output the thumbnail
- if ( (function_exists('has_post_thumbnail')) && (has_post_thumbnail()) ) :
- // Output the featured image ?>
- <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('portfolio-thumb'); ?></a>
- <?php endif; ?>
- <?php // Output the title of each portfolio item ?>
- <h4><a href="<?php the_permalink(); ?>"><?php echo get_the_title(); ?></a></h4>
- <?php the_excerpt(); ?>
- <div class="count hidden"></div>
- </li>
- <?php $count++; // Increase the count by 1 ?>
- <?php endwhile; endif; // END the Wordpress Loop ?>
- </ul>
- <?php dt_navigation(); ?>
- <?php wp_reset_query(); // Reset the Query Loop ?>
- </section>
- </div><!--end centered-wrapper-->
- <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement