Advertisement
Guest User

Untitled

a guest
Jan 20th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /**
  3. * Template Name: Blog Grid
  4. * The main template file for display blog page.
  5. *
  6. * @package WordPress
  7. */
  8.  
  9. /**
  10. * Get Current page object
  11. **/
  12. $page = get_page($post->ID);
  13.  
  14. /**
  15. * Get current page id
  16. **/
  17.  
  18. if(!isset($current_page_id) && isset($page->ID))
  19. {
  20. $current_page_id = $page->ID;
  21. }
  22.  
  23. get_header();
  24. ?>
  25.  
  26. <br class="clear"/>
  27.  
  28. <?php
  29. $is_display_page_content = TRUE;
  30. $is_standard_wp_post = FALSE;
  31.  
  32. //Include custom header feature
  33. get_template_part("/templates/template-header");
  34. ?>
  35.  
  36. <div class="inner">
  37.  
  38. <!-- Begin main content -->
  39. <div class="inner_wrapper">
  40.  
  41. <div id="blog_grid_wrapper" class="sidebar_content full_width">
  42.  
  43.  
  44. <?php
  45.  
  46. global $more; $more = false;
  47.  
  48. // $query_string ="post_type=post&paged=$paged";
  49.  
  50. $query_args = array('category_name' => '#nameOfCategoryThatYouWantToFilter#',
  51. 'post_type => 'post',
  52. 'paged' => $paged,);
  53.  
  54. $the_query = new WP_Query($query_args);
  55.  
  56. //query_posts($query_string);
  57. $key = 0;
  58.  
  59. if ($the_query->have_posts()) : while ($the_query->have_posts()) : the_post();
  60.  
  61. $animate_layer = $key+7;
  62. $image_thumb = '';
  63.  
  64. if(has_post_thumbnail(get_the_ID(), 'large'))
  65. {
  66. $image_id = get_post_thumbnail_id(get_the_ID());
  67. $image_thumb = wp_get_attachment_image_src($image_id, 'large', true);
  68. }
  69. ?>
  70.  
  71. <!-- Begin each blog post -->
  72. <div id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  73.  
  74. <div class="post_wrapper grid_layout">
  75.  
  76. <?php
  77. //Get post featured content
  78. $post_ft_type = get_post_meta(get_the_ID(), 'post_ft_type', true);
  79.  
  80. switch($post_ft_type)
  81. {
  82. case 'Image':
  83. default:
  84. if(!empty($image_thumb))
  85. {
  86. $small_image_url = wp_get_attachment_image_src($image_id, 'blog', true);
  87. ?>
  88.  
  89. <div class="post_img small">
  90. <a href="<?php the_permalink(); ?>">
  91. <img src="<?php echo $small_image_url[0]; ?>" alt="" class="" style="width:<?php echo $small_image_url[1]; ?>px;height:<?php echo $small_image_url[2]; ?>px;"/>
  92. <div class="mask">
  93. <div class="mask_circle grid">
  94. <i class="fa fa-external-link"/></i>
  95. </div>
  96. </div>
  97. </a>
  98. </div>
  99.  
  100. <?php
  101. }
  102. break;
  103.  
  104. case 'Vimeo Video':
  105. $post_ft_vimeo = get_post_meta(get_the_ID(), 'post_ft_vimeo', true);
  106. ?>
  107. <?php echo do_shortcode('[tg_vimeo video_id="'.$post_ft_vimeo.'" width="670" height="377"]'); ?>
  108. <br/>
  109. <?php
  110. break;
  111.  
  112. case 'Youtube Video':
  113. $post_ft_youtube = get_post_meta(get_the_ID(), 'post_ft_youtube', true);
  114. ?>
  115. <?php echo do_shortcode('[tg_youtube video_id="'.$post_ft_youtube.'" width="670" height="377"]'); ?>
  116. <br/>
  117. <?php
  118. break;
  119.  
  120. case 'Gallery':
  121. $post_ft_gallery = get_post_meta(get_the_ID(), 'post_ft_gallery', true);
  122. ?>
  123. <?php echo do_shortcode('[tg_gallery_slider gallery_id="'.$post_ft_gallery.'" size="gallery_2" width="670" height="270"]'); ?>
  124. <?php
  125. break;
  126.  
  127. } //End switch
  128. ?>
  129.  
  130. <div class="blog_grid_content">
  131. <?php
  132. //Check post format
  133. $post_format = get_post_format(get_the_ID());
  134.  
  135. switch($post_format)
  136. {
  137. case 'quote':
  138. ?>
  139.  
  140. <i class="post_qoute_mark fa fa-quote-right grid"></i>
  141.  
  142. <div class="post_header quote">
  143. <div class="post_quote_title grid">
  144. <a href="<?php the_permalink(); ?>"><?php the_content(); ?></a>
  145.  
  146. <div class="post_detail">
  147. <?php echo _e( 'On', 'proxima-domain' ); ?>&nbsp;<?php echo get_the_time(THEMEDATEFORMAT); ?>&nbsp;
  148. <?php echo _e( 'And has', 'proxima-domain' ); ?>&nbsp;<a href="<?php comments_link(); ?>"><?php comments_number(__('No Comment', 'proxima-domain'), __('1 Comment', 'proxima-domain'), __('% Comments', 'proxima-domain')); ?></a>
  149. </div>
  150. </div>
  151. </div>
  152. <?php
  153. break;
  154.  
  155. case 'link':
  156. ?>
  157.  
  158. <i class="post_qoute_mark fa fa-link grid"></i>
  159.  
  160. <div class="post_header quote">
  161. <div class="post_quote_title grid">
  162. <?php the_content(); ?>
  163.  
  164. <div class="post_detail">
  165. <?php echo _e( 'On', 'proxima-domain' ); ?>&nbsp;<?php echo get_the_time(THEMEDATEFORMAT); ?>&nbsp;
  166. <?php echo _e( 'And has', 'proxima-domain' ); ?>&nbsp;<a href="<?php comments_link(); ?>"><?php comments_number(__('No Comment', 'proxima-domain'), __('1 Comment', 'proxima-domain'), __('% Comments', 'proxima-domain')); ?></a>
  167. </div>
  168. </div>
  169. </div>
  170. <?php
  171. break;
  172.  
  173. default:
  174. ?>
  175. <div class="post_header grid">
  176. <h6><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h6>
  177. <div class="post_detail">
  178. <?php echo _e( 'On', 'proxima-domain' ); ?>&nbsp;<?php echo get_the_time(THEMEDATEFORMAT); ?>&nbsp;
  179. <?php echo _e( 'And has', 'proxima-domain' ); ?>&nbsp;<a href="<?php comments_link(); ?>"><?php comments_number(__('No Comment', 'proxima-domain'), __('1 Comment', 'proxima-domain'), __('% Comments', 'proxima-domain')); ?></a>
  180. </div>
  181. </div>
  182.  
  183. <br class="clear"/>
  184.  
  185. <a href="<?php the_permalink(); ?>"><strong><?php echo _e( 'Read More', 'proxima-domain' ); ?></strong></a>
  186. <?php
  187. break;
  188. }
  189. ?>
  190. </div>
  191.  
  192. </div>
  193.  
  194. </div>
  195. <!-- End each blog post -->
  196.  
  197. <?php $key++; ?>
  198. <?php endwhile; endif; ?>
  199.  
  200. </div>
  201.  
  202. </div>
  203. <!-- End main content -->
  204. <?php
  205.  
  206. if($wp_query->max_num_pages > 1)
  207. {
  208. if (function_exists("wpapi_pagination"))
  209. {
  210. ?>
  211. <br class="clear"/><br/><br/>
  212. <?php
  213. wpapi_pagination($wp_query->max_num_pages);
  214. }
  215. else
  216. {
  217. ?>
  218. <div class="pagination"><p><?php posts_nav_link(' '); ?></p></div>
  219. <?php
  220. }
  221. ?>
  222.  
  223. <?php
  224. }
  225. ?>
  226.  
  227. </div>
  228. <br class="clear"/><br/>
  229. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement