Guest User

Untitled

a guest
Feb 22nd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.63 KB | None | 0 0
  1. <?php
  2. $post_type = 'appoint_portfolio';
  3. $tax = 'portfolio_categories';
  4. // $term_args=array( 'hide_empty' => true,'orderby' => 'id');
  5. $term_args = array('hide_empty' => true, 'orderby' => 'id','exclude' => '5');
  6. $tax_terms = get_terms($tax, $term_args);
  7. $defualt_tex_id = get_option('appointment_webriti_default_term_id');
  8. $j=1;
  9. $tab= get_option('tab');
  10. if(isset($_GET['div']))
  11. {
  12. $tab=$_GET['div'];
  13. }
  14. ?>
  15.  
  16. <div class="page-builder">
  17.  
  18. <div class="container">
  19.  
  20. <div class="row">
  21. <div class="col-md-12">
  22. <div class="portfolio-tabs-section">
  23. <ul id="mytabs" class="portfolio-tabs">
  24. <?php foreach ($tax_terms as $tax_term) {
  25. ?>
  26. <li class="tab <?php if($tab==''){if($j==1){echo 'active';$j=2;}}else if($tab==$tax_term->slug){echo 'active';}?>"><a id="tab" href="#<?php echo $tax_term->slug; ?>" data-toggle="tab"><?php echo $tax_term->name; ?></a></li>
  27. <?php } ?>
  28. </ul>
  29. </div>
  30. </div>
  31. </div><!-- .row -->
  32.  
  33. <div class="tab-content main-portfolio-section" id="">
  34.  
  35. <?php
  36. global $paged;
  37. $curpage = $paged ? $paged : 1;
  38.  
  39. $norecord=0;
  40. $total_posts=0;
  41. $min_post_start=0;
  42. $is_active=true;
  43.  
  44. if ($tax_terms)
  45. {
  46. foreach ($tax_terms as $tax_term)
  47. {
  48. if(isset($_POST['total_posts']))
  49. {
  50. $count_posts = $_POST['total_posts'];
  51. }
  52. else
  53. {
  54. //$count_posts = wp_count_posts( $post_type)->publish;
  55. if(is_page_template('portfolio-2-col.php')) {$count_posts = 4;}
  56. if(is_page_template('portfolio-3-col.php')) {$count_posts = 6;}
  57. if(is_page_template('portfolio-4-col.php')) {$count_posts = 8;}
  58.  
  59. }
  60.  
  61. if(isset($_POST['min_post_start']))
  62. {
  63. $min_post_start = $_POST['min_post_start'];
  64. }
  65.  
  66. $total_posts=$count_posts;
  67.  
  68. $args = array (
  69. 'max_num_pages' =>5,
  70. 'post_status' => 'publish',
  71. 'post_type' => $post_type,
  72. 'portfolio_categories' => $tax_term->slug,
  73. 'posts_per_page' =>$count_posts,
  74. 'paged' => $curpage,
  75. );
  76.  
  77. global $j;
  78. $j=1;
  79. $portfolio_query = null;
  80. $portfolio_query = new WP_Query($args);
  81.  
  82. if( $portfolio_query->have_posts() ):
  83.  
  84. ?>
  85.  
  86. <div id="<?php echo $tax_term->slug; ?>" class="tab-pane fade in <?php if($tab==''){if($is_active==true){echo 'active';}$is_active=false;}else if($tab==$tax_term->slug){echo 'active';} ?>">
  87.  
  88.  
  89. <div class="row">
  90.  
  91. <?php while ($portfolio_query->have_posts()) : $portfolio_query->the_post(); ?>
  92.  
  93. <?php
  94.  
  95. $project_link_chkbx = sanitize_text_field( get_post_meta( get_the_ID(), 'project_link_chkbx', true ));
  96.  
  97. if(get_post_meta( get_the_ID(),'project_more_btn_link', true )) {
  98. $project_more_btn_link = get_post_meta( get_the_ID(),'project_more_btn_link', true );
  99. }
  100. else
  101. {
  102. $project_more_btn_link = '';
  103. }
  104.  
  105. $class = '';
  106.  
  107. if(is_page_template('portfolio-2-col.php')) {
  108. $class = 'col-md-6 col-md-6 portfolio-area';
  109. }
  110.  
  111. if(is_page_template('portfolio-3-col.php')) {
  112. $class = 'col-md-4 col-md-6 portfolio-area';
  113. }
  114.  
  115. if(is_page_template('portfolio-4-col.php')) {
  116. $class = 'col-md-3 col-md-6 portfolio-area';
  117. }
  118.  
  119. echo '<div class="'.$class.'">';
  120. ?>
  121.  
  122. <div class="portfolio-image">
  123. <?php if(is_page_template('portfolio-2-col.php')) {
  124. appointment_image_thumbnail('','img-responsive');
  125. } ?>
  126.  
  127. <?php if(is_page_template('portfolio-3-col.php')) {
  128. appointment_image_thumbnail('','img-responsive');
  129. } ?>
  130.  
  131. <?php if(is_page_template('portfolio-4-col.php')) {
  132. appointment_image_thumbnail('','img-responsive');
  133. } ?>
  134.  
  135. <?php
  136. if(has_post_thumbnail())
  137. {
  138. $post_thumbnail_id = get_post_thumbnail_id();
  139. $post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id );
  140. }
  141. ?>
  142. <div class="portfolio-showcase-overlay">
  143.  
  144. <div class="portfolio-showcase-overlay-inner">
  145.  
  146. <div class="portfolio-showcase-icons">
  147.  
  148. <?php if(isset($post_thumbnail_url)){ ?>
  149. <a href="<?php echo $post_thumbnail_url; ?>" data-lightbox="image" title="<?php the_title(); ?>" class="hover_thumb"><i class="fa fa-search"></i></a>
  150. <?php } ?>
  151. <?php if(!empty($project_more_btn_link)) {?>
  152. <a href="<?php echo $project_more_btn_link;?>" <?php if(!empty($project_link_chkbx)){ echo 'target="_blank"'; } ?> title="Appointment" class="hover_thumb"><i class="fa fa-plus"></i></a>
  153. <?php } ?>
  154.  
  155. </div>
  156.  
  157. </div>
  158.  
  159. </div>
  160.  
  161. </div><!-- .portfolio-image -->
  162.  
  163. <div class="portfolio-caption">
  164.  
  165. <h4><?php if(!empty($project_more_btn_link)) {?>
  166. <a href="<?php echo $project_more_btn_link;?>" <?php if(!empty($project_link_chkbx)){ echo 'target="_blank"'; } ?> class="hover_thumb"><?php the_title(); ?></a>
  167. <?php } else the_title(); ?></h4>
  168. <?php if(get_post_meta( get_the_ID(), 'project_description', true )){ ?>
  169. <p><?php echo get_post_meta( get_the_ID(), 'project_description', true ); ?></p>
  170. <?php } ?>
  171.  
  172. </div><!-- .portfolio-caption -->
  173.  
  174. <?php echo '</div>'; ?>
  175.  
  176. <?php
  177. // call clearfix css class
  178. appointment_portfolio_clearfix($j);
  179.  
  180. $norecord=1;
  181. ?>
  182.  
  183. <?php endwhile; ?>
  184.  
  185. <?php
  186.  
  187. $count_posts_2c = wp_count_posts('appoint_portfolio')->publish;
  188.  
  189. if($count_posts_2c > 4) {
  190. $Webriti_pagination = new Webriti_pagination();
  191. $Webriti_pagination->Webriti_page($curpage, $portfolio_query);
  192. }
  193. else if($count_posts_2c > 6)
  194. {
  195. $Webriti_pagination = new Webriti_pagination();
  196. $Webriti_pagination->Webriti_page($curpage, $portfolio_query);
  197. }
  198. else if($count_posts_2c > 8)
  199. {
  200. $Webriti_pagination = new Webriti_pagination();
  201. $Webriti_pagination->Webriti_page($curpage, $portfolio_query);
  202. }
  203. ?>
  204.  
  205.  
  206. </div>
  207.  
  208. </div>
  209.  
  210. <?php
  211.  
  212. wp_reset_query();
  213.  
  214. else:
  215.  
  216. ?>
  217. <div id="<?php echo $tax_term->slug; ?>" class="tab-pane fade in <?php if($tab==''){if($is_active==true){echo 'active';}$is_active=false;}else if($tab==$tax_term->slug){echo 'active';} ?>"></div>
  218. <?php
  219.  
  220. endif;
  221.  
  222.  
  223. }
  224. }
  225. ?>
  226.  
  227. </div><!-- .tab-content -->
  228.  
  229. </div><!-- .container -->
  230.  
  231. </div><!-- .page-builder -->
  232.  
  233. <!-- /Portfolio Section -->
  234.  
  235.  
  236. <script type="text/javascript">
  237. jQuery('.tab').click(function(e) {
  238. e.preventDefault();
  239. var h = jQuery("a",this).attr('href').replace(/#/, "");
  240. jQuery.ajax({
  241. url: "",
  242. type: "POST",
  243. data: { code : h },
  244. dataType: "html"
  245. });
  246. });
  247.  
  248. </script>
  249.  
  250.  
  251.  
  252. <?php
  253.  
  254. if(isset($_POST['code'])){
  255.  
  256. $code = $_POST['code'];
  257. update_option('tab',$code);
  258.  
  259. }
  260.  
  261. get_footer();
Add Comment
Please, Sign In to add comment