Advertisement
Guest User

Untitled

a guest
May 14th, 2017
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.66 KB | None | 0 0
  1.  
  2. <?php
  3. /*
  4. Template Name: Front Page 2
  5. */
  6. ?>
  7. <?php
  8. /**
  9. * The main template file.
  10. *
  11. * This is the most generic template file in a WordPress theme
  12. * and one of the two required files for a theme (the other being style.css).
  13. * It is used to display a page when nothing more specific matches a query.
  14. * E.g., it puts together the home page when no home.php file exists.
  15. * Learn more: http://codex.wordpress.org/Template_Hierarchy
  16. *
  17. * @package WordPress
  18. * @subpackage Twenty_Eleven
  19. */
  20. get_header();
  21. ?>
  22.  
  23. <div id="primary">
  24.  
  25. <div id="content_head" role="main_head">
  26.  
  27. <div id="home-slider">
  28. <?php
  29. /**
  30. * You can change the slider (integer) ID on "get_smooth_slider('ID');" from this page
  31. * http://bearleaderchronicle.com/pre/wp-admin/admin.php?page=smooth-slider-admin
  32. */
  33. ?>
  34.  
  35. <?php
  36. if (function_exists('get_smooth_slider')) {
  37. get_smooth_slider(2);
  38. }
  39. ?>
  40.  
  41. </div>
  42.  
  43. </div><!-- #content_head -->
  44.  
  45. <div id="content_left" role="main_left">
  46.  
  47. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  48.  
  49. <?php
  50. $instance = array();
  51. $instance = array_merge(array(
  52. 'limit' => 7,
  53. 'offset' => 0,
  54. 'excerpt' => true,
  55. 'length' => 160,
  56. 'thumb' => true,
  57. 'thumb_height' => 309,
  58. 'thumb_width' => 309,
  59. 'cat' => '935',
  60. 'post_type' => 'post',
  61. 'date' => true,
  62. ), $instance);
  63.  
  64. $limit = $instance['limit'];
  65. $offset = $instance['offset'];
  66. $excerpt = $instance['excerpt'];
  67. $length = (int) ( $instance['length'] );
  68. $thumb = $instance['thumb'];
  69. $thumb_height = (int) ( $instance['thumb_height'] );
  70. $thumb_width = (int) ( $instance['thumb_width'] );
  71. $cat = $instance['cat'];
  72. $post_type = $instance['post_type'];
  73. $date = $instance['date'];
  74. //$css = wp_filter_nohtml_kses($instance['css']);
  75. //$sticky = get_field('sticky_post');
  76. //var_dump($sticky);
  77.  
  78. static $exclude_ids;
  79.  
  80. // WP_Query arguments
  81. $args = array(
  82. 'offset' => $offset,
  83. //'post__in' => $sticky,
  84. 'posts_per_page' => $limit,
  85. 'cat' => $cat,
  86. 'post_type' => $post_type,
  87. 'post__not_in' => $exclude_ids,
  88. 'orderby' => 'rand'
  89. );
  90.  
  91. // The Query
  92. $query = new WP_Query($args);
  93.  
  94. ?>
  95.  
  96. <div class="rpwebb-block">
  97. <?php if ($query->have_posts()) : ?>
  98. <ul>
  99.  
  100. <?php while ($query->have_posts()) : $query->the_post(); ?>
  101.  
  102. <?php $custom_fp_class = get_post_meta($post->ID, 'fp_post_style', true); ?>
  103.  
  104. <?php
  105. $exclude_ids[] = get_the_ID();
  106. $ext_url = get_post_meta(get_the_ID(), 'RPW_externalurl', true);
  107. $ext_url = !empty($ext_url) ? $ext_url : get_permalink();
  108. ?>
  109. <li class="rpwe-clearfix <?php echo ' ' . $custom_fp_class; ?>" >
  110.  
  111. <?php if (has_post_thumbnail() && $thumb == true) { ?>
  112.  
  113. <a href="<?php echo $ext_url; ?>" class="<?php echo ($thumb_width < $thumb_height) ? 'height-alto' : 'no-alto' ?>" title="<?php printf(esc_attr__('Permalink to %s', 'rpwe'), the_title_attribute('echo=0')); ?>" rel="bookmark">
  114. <?php
  115. if (current_theme_supports('get-the-image'))
  116. get_the_image(array('meta_key' => 'Thumbnail', 'height' => $thumb_height, 'width' => $thumb_width, 'image_class' => 'rpwe-alignleft', 'link_to_post' => false));
  117. else
  118. the_post_thumbnail(array($thumb_width, $thumb_height), array('class' => 'rpwe-alignleft', 'alt' => esc_attr(get_the_title()), 'title' => esc_attr(get_the_title())));
  119. ?>
  120. </a>
  121.  
  122. <?php } ?>
  123.  
  124. <h3 class="rpwe-title">
  125. <a href="<?php echo $ext_url; ?>" title="<?php printf(esc_attr__('Permalink to %s', 'rpwe'), the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a>
  126. </h3>
  127.  
  128. <?php if ($date == true) { ?>
  129. <span class="rpwe-time"><?php echo the_time('g:i a'); ?></span>
  130. <?php } ?>
  131.  
  132. <?php if(get_field('fp_author')) { echo '<p class="fp_author">' . get_field('fp_author') . '</p>';}
  133. ?>
  134.  
  135. <?php if ($ago == true) { ?>
  136. <span class="rpwe-time"><?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . __(' ago', 'rpwe'); ?></span>
  137. <?php } ?>
  138.  
  139. <?php if ($excerpt == true) { ?>
  140. <div class="rpwe-summary"><p><?php echo blc_excerpt($length); ?></p><p><a href="<?php echo $ext_url; ?>">Read more ></a></p></div>
  141. <?php } ?>
  142.  
  143. </li>
  144.  
  145. <?php endwhile; ?>
  146. <?php wp_reset_postdata(); ?>
  147.  
  148. </ul>
  149. <?php endif; ?>
  150. </div>
  151.  
  152. <div class="clear"></div>
  153.  
  154. <footer class="entry-meta">
  155. <?php edit_post_link(__('Edit', 'twentyeleven'), '<span class="edit-link">', '</span>'); ?>
  156. <div class="clear"></div>
  157. </footer><!-- .entry-meta -->
  158. <div class="clear"></div>
  159. </article><!-- #post-<?php the_ID(); ?> -->
  160.  
  161. </div><!-- #content_left -->
  162.  
  163. <div id="content_right" role="main_right">
  164.  
  165. <?php
  166. // WP_Query arguments
  167. global $paged;
  168.  
  169. $paged = ( get_query_var('page') ) ? get_query_var('page') : 1;
  170.  
  171. $args = array(
  172. 'paged' => $paged,
  173. 'cat' => blc_get_main_categories(),
  174. // MN input "3" on the next line instead of this-> get_option('posts_per_page'),
  175. 'posts_per_page' => 3
  176. );
  177.  
  178. // The Query
  179. $query = new WP_Query($args);
  180. ?>
  181.  
  182. <?php if ($query->have_posts()) : ?>
  183.  
  184. <?php /* Start the Loop */ ?>
  185. <?php while ($query->have_posts()) : $query->the_post(); ?>
  186.  
  187. <?php get_template_part('content', 'home2'); ?>
  188.  
  189. <?php endwhile; ?>
  190. <?php wp_reset_postdata(); ?>
  191.  
  192. <?php else : ?>
  193.  
  194. <article id="post-0" class="post no-results not-found">
  195. <header class="entry-header">
  196. <h1 class="entry-title"><?php _e('Nothing Found!', 'twentyeleven'); ?></h1>
  197. </header><!-- .entry-header -->
  198.  
  199. <div class="entry-content">
  200. <p><?php _e('Apologies, but no results were found for the requested archive. Perhaps searching will help find a related post.', 'twentyeleven'); ?></p>
  201. <?php get_search_form(); ?>
  202. </div><!-- .entry-content -->
  203. </article><!-- #post-0 -->
  204.  
  205. <?php endif; ?>
  206.  
  207. </div><!-- #content_right -->
  208.  
  209. <div id="content_video" role="main_video">
  210.  
  211. <header class="bottom-sec-headers">Latest Video</header>
  212.  
  213. <article id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
  214.  
  215. <?php
  216. $instance = array();
  217. $instance = array_merge(array(
  218. 'limit' => 7,
  219. 'offset' => 0,
  220. 'excerpt' => true,
  221. 'length' => 160,
  222. 'thumb' => true,
  223. 'thumb_height' => 309,
  224. 'thumb_width' => 309,
  225. 'cat' => '935',
  226. 'post_type' => 'post',
  227. 'date' => true,
  228. ), $instance);
  229.  
  230. $limit = $instance['limit'];
  231. $offset = $instance['offset'];
  232. $excerpt = $instance['excerpt'];
  233. $length = (int) ( $instance['length'] );
  234. $thumb = $instance['thumb'];
  235. $thumb_height = (int) ( $instance['thumb_height'] );
  236. $thumb_width = (int) ( $instance['thumb_width'] );
  237. $cat = $instance['cat'];
  238. $post_type = $instance['post_type'];
  239. $date = $instance['date'];
  240. //$css = wp_filter_nohtml_kses($instance['css']);
  241. //$sticky = get_field('sticky_post');
  242. //var_dump($sticky);
  243.  
  244. static $exclude_ids;
  245.  
  246. // WP_Query arguments
  247. $args = array(
  248. 'offset' => $offset,
  249. //'post__in' => $sticky,
  250. 'posts_per_page' => $limit,
  251. 'cat' => $cat,
  252. 'post_type' => $post_type,
  253. 'post__not_in' => $exclude_ids,
  254. 'orderby' => 'rand'
  255. );
  256.  
  257. // The Query
  258. $query = new WP_Query($args);
  259.  
  260. ?>
  261.  
  262. <div class="rpwebb-block">
  263. <?php if ($query->have_posts()) : ?>
  264. <ul>
  265.  
  266. <?php while ($query->have_posts()) : $query->the_post(); ?>
  267.  
  268. <?php $custom_fp_class = get_post_meta($post->ID, 'fp_post_style', true); ?>
  269.  
  270. <?php
  271. $exclude_ids[] = get_the_ID();
  272. $ext_url = get_post_meta(get_the_ID(), 'RPW_externalurl', true);
  273. $ext_url = !empty($ext_url) ? $ext_url : get_permalink();
  274. ?>
  275. <li class="rpwe-clearfix <?php echo ' ' . $custom_fp_class; ?>" >
  276.  
  277. <?php if (has_post_thumbnail() && $thumb == true) { ?>
  278.  
  279. <a href="<?php echo $ext_url; ?>" class="<?php echo ($thumb_width < $thumb_height) ? 'height-alto' : 'no-alto' ?>" title="<?php printf(esc_attr__('Permalink to %s', 'rpwe'), the_title_attribute('echo=0')); ?>" rel="bookmark">
  280. <?php
  281. if (current_theme_supports('get-the-image'))
  282. get_the_image(array('meta_key' => 'Thumbnail', 'height' => $thumb_height, 'width' => $thumb_width, 'image_class' => 'rpwe-alignleft', 'link_to_post' => false));
  283. else
  284. the_post_thumbnail(array($thumb_width, $thumb_height), array('class' => 'rpwe-alignleft', 'alt' => esc_attr(get_the_title()), 'title' => esc_attr(get_the_title())));
  285. ?>
  286. </a>
  287.  
  288. <?php } ?>
  289.  
  290. <h3 class="rpwe-title">
  291. <a href="<?php echo $ext_url; ?>" title="<?php printf(esc_attr__('Permalink to %s', 'rpwe'), the_title_attribute('echo=0')); ?>" rel="bookmark"><?php the_title(); ?></a>
  292. </h3>
  293.  
  294. <?php if ($date == true) { ?>
  295. <span class="rpwe-time"><?php echo the_time('g:i a'); ?></span>
  296. <?php } ?>
  297.  
  298. <?php if(get_field('fp_author')) { echo '<p class="fp_author">' . get_field('fp_author') . '</p>';}
  299. ?>
  300.  
  301. <?php if ($ago == true) { ?>
  302. <span class="rpwe-time"><?php echo human_time_diff(get_the_time('U'), current_time('timestamp')) . __(' ago', 'rpwe'); ?></span>
  303. <?php } ?>
  304.  
  305. <?php if ($excerpt == true) { ?>
  306. <div class="rpwe-summary"><p><?php echo blc_excerpt($length); ?></p><p><a href="<?php echo $ext_url; ?>">Read more ></a></p></div>
  307. <?php } ?>
  308.  
  309. </li>
  310.  
  311. <?php endwhile; ?>
  312. <?php wp_reset_postdata(); ?>
  313.  
  314. </ul>
  315. <?php endif; ?>
  316. </div>
  317.  
  318. <div class="clear"></div>
  319.  
  320. <footer class="entry-meta">
  321. <?php edit_post_link(__('Edit', 'twentyeleven'), '<span class="edit-link">', '</span>'); ?>
  322. <div class="clear"></div>
  323. </footer><!-- .entry-meta -->
  324. <div class="clear"></div>
  325. </article><!-- #post-<?php the_ID(); ?> -->
  326.  
  327. </div><!-- #content_video -->
  328.  
  329. <div id="content_eat" role="main_eat">
  330. <header class="bottom-sec-headers">Eat</header>
  331. </div><!-- #content_eat -->
  332.  
  333. <div id="content_stay" role="main_stay">
  334. <header class="bottom-sec-headers">Stay</header>
  335. </div><!-- #content_stay -->
  336.  
  337. <div id="content_city-guide" role="main_city-guide">
  338. <header class="bottom-sec-headers">City Guides</header>
  339. </div><!-- #content_city-guide -->
  340.  
  341. <div id="content_thoughts-on-travel" role="main_thoughts-on-travel">
  342. <header class="bottom-sec-headers">Thoughts on Travel</header>
  343. </div><!-- #content_thoughts-on-travel -->
  344.  
  345. </div><!-- #primary -->
  346.  
  347. <?php get_sidebar(); ?>
  348. <div class="clear"></div>
  349. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement