Guest User

Untitled

a guest
Feb 10th, 2020
29
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.66 KB | None | 0 0
  1. <?php
  2. $post_type = 'spicepress_portfolio';
  3. $tax = 'portfolio_categories';
  4. $term_args=array( 'hide_empty' => true,'orderby' => 'id');
  5. $tax_terms = get_terms($tax, $term_args);
  6. $defualt_tex_id = get_option('spicepress_default_term_id');
  7. $j=1;
  8. $tab= get_option('tab');
  9. if(isset($_GET['div']))
  10. {
  11. $tab=$_GET['div'];
  12. }
  13. $portfolio_tmp_title = get_theme_mod('portfolio_tmp_title',__('Portfolio title','spicepress'));
  14. $portfolio_tmp_desc = get_theme_mod('portfolio_tmp_desc','Sea summo mazim ex, ea errem eleifend definitionem vim. Ut nec hinc dolor possim mei ludus efficiendi ei sea summo mazim ex.');
  15. ?>
  16.  
  17. <section class="portfolio-section padding-0">
  18. <div class="container">
  19. <!-- Section Title -->
  20. <div class="row">
  21. <div class="col-md-12">
  22. <div class="section-header">
  23. <h1 class="widget-title wow fadeInUp animated animated" data-wow-duration="500ms" data-wow-delay="0ms"><?php echo esc_attr($portfolio_tmp_title); ?></h1>
  24. <div class="widget-separator"><span></span></div>
  25. <p class="wow fadeInDown animated"><?php echo esc_attr($portfolio_tmp_desc); ?></p>
  26. </div>
  27. </div>
  28. </div>
  29. <!-- /Section Title -->
  30.  
  31. <div class="row">
  32. <ul id="mytabs" class="portfolio-tabs">
  33. <?php foreach ($tax_terms as $tax_term) {
  34. ?>
  35. <li class="tab <?php if($tab==''){if($j==1){echo 'active';$j=2;}}else if($tab==rawurldecode($tax_term->slug)){echo 'active';}?>"><a id="tab" href="#<?php echo rawurldecode($tax_term->slug); ?>" data-toggle="tab"><?php echo $tax_term->name; ?></a></li>
  36. <?php } ?>
  37. </ul>
  38. </div><!-- .row -->
  39.  
  40. <div class="tab-content" id="myTabContent">
  41.  
  42. <?php
  43. global $paged;
  44. $curpage = $paged ? $paged : 1;
  45.  
  46. $norecord=0;
  47. $total_posts=0;
  48. $min_post_start=0;
  49. $is_active=true;
  50.  
  51. if ($tax_terms)
  52. {
  53. foreach ($tax_terms as $tax_term)
  54. {
  55. if(isset($_POST['total_posts']))
  56. {
  57. $count_posts = $_POST['total_posts'];
  58. }
  59. else
  60. {
  61. //$count_posts = wp_count_posts( $post_type)->publish;
  62. if(is_page_template('template/template-portfolio-2-col.php')) {$count_posts = 4;}
  63. if(is_page_template('template/template-portfolio-2-col.php')) {$count_posts = 6;}
  64. if(is_page_template('template/template-portfolio-2-col.php')) {$count_posts = 8;}
  65.  
  66. }
  67.  
  68. if(isset($_POST['min_post_start']))
  69. {
  70. $min_post_start = $_POST['min_post_start'];
  71. }
  72.  
  73. //$total_posts=$count_posts;
  74.  
  75. $args = array (
  76. 'max_num_pages' =>5,
  77. 'post_status' => 'publish',
  78. 'post_type' => $post_type,
  79. 'portfolio_categories' => rawurldecode($tax_term->slug),
  80. //'posts_per_page' =>$count_posts,
  81. 'paged' => $curpage,
  82. );
  83.  
  84.  
  85. $portfolio_query = null;
  86. $portfolio_query = new WP_Query($args);
  87.  
  88. if( $portfolio_query->have_posts() ):
  89.  
  90. ?>
  91.  
  92. <div id="<?php echo rawurldecode($tax_term->slug); ?>" class="tab-pane fade in <?php if($tab==''){if($is_active==true){echo 'active';}$is_active=false;}else if($tab==rawurldecode($tax_term->slug)){echo 'active';} ?>">
  93.  
  94. <div class="row">
  95.  
  96. <?php while ($portfolio_query->have_posts()) : $portfolio_query->the_post(); ?>
  97.  
  98. <?php
  99.  
  100. $portfolio_target = sanitize_text_field( get_post_meta( get_the_ID(), 'portfolio_target', true ));
  101.  
  102. if(get_post_meta( get_the_ID(),'portfolio_link', true )) {
  103. $portfolio_link = get_post_meta( get_the_ID(),'portfolio_link', true );
  104. }
  105. else
  106. {
  107. $portfolio_link = '';
  108. }
  109.  
  110. $class = '';
  111.  
  112. if(is_page_template('template/template-portfolio-2-col.php')) {
  113. $class = 'col-md-6 col-sm-6 col-xs-12';
  114. }
  115.  
  116. if(is_page_template('template/template-portfolio-3-col.php')) {
  117. $class = 'col-md-4 col-sm-4 col-xs-12';
  118. }
  119.  
  120. if(is_page_template('template/template-portfolio-4-col.php')) {
  121. $class = 'col-md-3 col-sm-3 col-xs-12';
  122. }
  123.  
  124. echo '<div class="'.$class.'">';
  125. ?>
  126.  
  127. <article class="post">
  128. <figure class="post-thumbnail">
  129. <?php if(is_page_template('template/template-portfolio-2-col.php')) {
  130. spicepress_image_thumbnail('','img-responsive');
  131. } ?>
  132.  
  133. <?php if(is_page_template('template/template-portfolio-3-col.php')) {
  134. spicepress_image_thumbnail('','img-responsive');
  135. } ?>
  136.  
  137. <?php if(is_page_template('template/template-portfolio-4-col.php')) {
  138. spicepress_image_thumbnail('','img-responsive');
  139. } ?>
  140.  
  141. <?php
  142. if(has_post_thumbnail())
  143. {
  144. $post_thumbnail_id = get_post_thumbnail_id();
  145. $post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id );
  146. }
  147. ?>
  148. <div class="thumbnail-showcase-overlay">
  149.  
  150. <div class="thumbnail-showcase-icons">
  151.  
  152. <?php if(isset($post_thumbnail_url)){ ?>
  153. <a href="<?php echo $post_thumbnail_url; ?>" data-lightbox="image" title="<?php the_title(); ?>" class="hover_thumb"><i class="fa fa-picture-o"></i></a>
  154. <?php } ?>
  155. <?php if(!empty($portfolio_link)) {?>
  156. <a href="<?php echo $portfolio_link;?>" <?php if(!empty($portfolio_target)){ echo 'target="_blank"'; } ?> class="hover_thumb"><i class="fa fa-link"></i></a>
  157. <?php } ?>
  158.  
  159. </div>
  160.  
  161. </div>
  162.  
  163. </figure>
  164. <header class="entry-header">
  165. <h4 class="entry-title"><?php if(!empty($portfolio_link)) {?>
  166. <a href="<?php echo $portfolio_link;?>" <?php if(!empty($portfolio_target)){ echo 'target="_blank"'; } ?> class="hover_thumb"><?php the_title(); ?></a>
  167. <?php } else the_title(); ?>
  168. </h4>
  169. </header>
  170. <div class="entry-content">
  171. <?php if(get_post_meta( get_the_ID(), 'portfolio_title_description', true )){ ?>
  172. <p><?php echo get_post_meta( get_the_ID(), 'portfolio_title_description', true ); ?></p>
  173. <?php } ?>
  174. </div><!-- .portfolio-caption -->
  175. </article>
  176. <!-- .portfolio-image -->
  177.  
  178.  
  179.  
  180. <?php echo '</div>'; ?>
  181.  
  182. <?php
  183.  
  184. $norecord=1;
  185. ?>
  186.  
  187. <?php endwhile; ?>
  188. </div>
  189.  
  190. </div>
  191.  
  192. <?php
  193.  
  194. wp_reset_query();
  195.  
  196. else:
  197.  
  198. ?>
  199. <div id="<?php echo rawurldecode($tax_term->slug); ?>" class="tab-pane fade in <?php if($tab==''){if($is_active==true){echo 'active';}$is_active=false;}else if($tab==rawurldecode($tax_term->slug)){echo 'active';} ?>"></div>
  200. <?php
  201.  
  202. endif;
  203.  
  204.  
  205. }
  206. }
  207. ?>
  208.  
  209. </div><!-- .tab-content -->
  210. <div class="port_content">
  211. <?php the_post();
  212. echo the_content();
  213. ?>
  214. </div>
  215. </div><!-- .container -->
  216.  
  217. </section><!-- .page-builder -->
  218.  
  219. <!-- /Portfolio Section -->
  220.  
  221.  
  222. <script type="text/javascript">
  223. jQuery('.tab').click(function(e) {
  224. e.preventDefault();
  225. var h = decodeURI(jQuery("a",this).attr('href').replace(/#/, ""));
  226. jQuery.ajax({
  227. url: "",
  228. type: "POST",
  229. data: { code : h },
  230. dataType: "html"
  231. });
  232. });
  233.  
  234. </script>
  235. <?php
  236.  
  237. if(isset($_POST['code'])){
  238.  
  239. $code = $_POST['code'];
  240. update_option('tab',$code);
  241.  
  242. }
  243.  
  244. get_footer();
Add Comment
Please, Sign In to add comment