sdobwm

Untitled

Aug 5th, 2016
45
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.72 KB | None | 0 0
  1. <div class="page-builder">
  2.  
  3.  
  4. <div class="container">
  5. <?php the_post(); ?><div class="content_portfolio"><p><?php echo the_content(); ?></p></div>
  6. <?php
  7. $post_type = 'appoint_portfolio';
  8. $tax = 'portfolio_categories';
  9. $term_args=array( 'hide_empty' => true,'orderby' => 'id');
  10. $tax_terms = get_terms($tax, $term_args);
  11. $defualt_tex_id = get_option('appointment_webriti_default_term_id');
  12. $j=1;
  13. $tab= get_option('tab');
  14. if(isset($_GET['div']))
  15. {
  16. $tab=$_GET['div'];
  17. }
  18. ?>
  19. <!--Portfolio Tabs-->
  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>
  32. <!--/Portfolio Tabs-->
  33.  
  34. <!-- Portfolio Area -->
  35. <div class="tab-content main-portfolio-section" id="">
  36. <?php
  37.  
  38. global $paged;
  39. $curpage = $paged ? $paged : 1;
  40.  
  41. $norecord=0;
  42. $total_posts=0;
  43. $min_post_start=0;
  44. $is_active=true;
  45. if ($tax_terms)
  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. if(isset($_POST['min_post_start']))
  61. {
  62. $min_post_start = $_POST['min_post_start'];
  63. }
  64.  
  65. $total_posts=$count_posts;
  66.  
  67. $args = array (
  68. 'max_num_pages' =>5,
  69. 'post_status' => 'publish',
  70. 'post_type' => $post_type,
  71. 'portfolio_categories' => $tax_term->slug,
  72. 'posts_per_page' =>$count_posts,
  73. 'paged' => $curpage,
  74. );
  75.  
  76. global $j;
  77. $j=1;
  78. $portfolio_query = null;
  79. $portfolio_query = new WP_Query($args);
  80.  
  81. if( $portfolio_query->have_posts() )
  82. { ?>
  83. <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';} ?>">
  84. <div class="row">
  85. <?php
  86. while ($portfolio_query->have_posts()) { $portfolio_query->the_post();
  87. $project_link_chkbx = sanitize_text_field( get_post_meta( get_the_ID(), 'project_link_chkbx', true ));
  88.  
  89.  
  90.  
  91. if(get_post_meta( get_the_ID(),'project_more_btn_link', true )) {
  92. $project_more_btn_link = get_post_meta( get_the_ID(),'project_more_btn_link', true );
  93. }
  94. else
  95. {
  96. $project_more_btn_link = '';
  97. }
  98. ?>
  99.  
  100.  
  101. <?php if(is_page_template('portfolio-2-col.php')) { ?>
  102. <div class="col-md-6 col-md-6 portfolio-area">
  103. <?php } ?>
  104.  
  105. <?php if(is_page_template('portfolio-3-col.php')) { ?>
  106. <div class="col-md-4 col-md-6 portfolio-area">
  107. <?php } ?>
  108.  
  109. <?php if(is_page_template('portfolio-4-col.php')) { ?>
  110. <div class="col-md-3 col-md-6 portfolio-area">
  111. <?php } ?>
  112.  
  113. <div class="portfolio-image">
  114. <?php if(is_page_template('portfolio-2-col.php')) {
  115. appointment_image_thumbnail('','img-responsive');
  116. } ?>
  117.  
  118. <?php if(is_page_template('portfolio-3-col.php')) {
  119. appointment_image_thumbnail('','img-responsive');
  120. } ?>
  121.  
  122. <?php if(is_page_template('portfolio-4-col.php')) {
  123. appointment_image_thumbnail('','img-responsive');
  124. } ?>
  125.  
  126. <?php
  127. if(has_post_thumbnail())
  128. {
  129. $post_thumbnail_id = get_post_thumbnail_id();
  130. $post_thumbnail_url = wp_get_attachment_url($post_thumbnail_id );
  131. } ?>
  132. <div class="portfolio-showcase-overlay">
  133. <div class="portfolio-showcase-overlay-inner">
  134. <div class="portfolio-showcase-icons">
  135. <?php if(isset($post_thumbnail_url)){ ?>
  136. <a href="<?php echo $post_thumbnail_url; ?>" data-lightbox="image" title="<?php the_title(); ?>" class="hover_thumb"><i class="fa fa-search"></i></a>
  137. <?php } ?>
  138. <?php if(!empty($project_more_btn_link)) {?>
  139. <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>
  140. <?php } ?>
  141. </div>
  142. </div>
  143. </div>
  144. </div>
  145. <div class="portfolio-caption">
  146. <h4><?php if(!empty($project_more_btn_link)) {?>
  147. <a href="<?php echo $project_more_btn_link;?>" <?php if(!empty($project_link_chkbx)){ echo 'target="_blank"'; } ?> class="hover_thumb"><?php the_title(); ?></a>
  148. <?php } else the_title(); ?></h4>
  149. <?php if(get_post_meta( get_the_ID(), 'project_description', true )){ ?>
  150. <p><?php echo get_post_meta( get_the_ID(), 'project_description', true ); ?></p>
  151. <?php } ?>
  152. </div>
  153.  
  154. </div>
  155. <?php
  156. // call clearfix css class
  157. appointment_portfolio_clearfix($j);
  158.  
  159. $norecord=1; } ?>
  160. </div>
  161.  
  162. <?php $count_posts_2c = wp_count_posts('appoint_portfolio')->publish;
  163. if($count_posts_2c > 4) {
  164. $Webriti_pagination = new Webriti_pagination();
  165. $Webriti_pagination->Webriti_page($curpage, $portfolio_query);
  166. }
  167. else if($count_posts_2c > 6)
  168. {
  169. $Webriti_pagination = new Webriti_pagination();
  170. $Webriti_pagination->Webriti_page($curpage, $portfolio_query);
  171. }
  172. else if($count_posts_2c > 8)
  173. {
  174. $Webriti_pagination = new Webriti_pagination();
  175. $Webriti_pagination->Webriti_page($curpage, $portfolio_query);
  176. }
  177. ?>
  178. </div>
  179. <?php
  180. }else{
  181. ?>
  182. <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>
  183. <?php
  184. }
  185. }
  186. }
  187. ?>
  188. <?php wp_reset_query(); ?>
  189.  
  190. </div>
  191. <!-- /Load More Projects Btn -->
  192. </div>
  193. </div>
  194. <!-- /Portfolio Area1 -->
  195.  
  196. </div>
  197. </div>
  198. <!-- /Portfolio Section -->
  199. <script type="text/javascript">
  200. jQuery('.tab').click(function(e) {
  201. e.preventDefault();
  202. var h = jQuery("a",this).attr('href').replace(/#/, "");
  203. jQuery.ajax({
  204. url: "",
  205. type: "POST",
  206. data: { code : h },
  207. dataType: "html"
  208. });
  209. });
  210.  
  211. </script>
  212. <?php
  213. if(isset($_POST['code'])){
  214. $code = $_POST['code'];
  215. update_option('tab',$code);
  216. }
  217. get_footer();
Add Comment
Please, Sign In to add comment