Guest User

Untitled

a guest
Sep 24th, 2018
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.30 KB | None | 0 0
  1. <?php
  2. /**
  3. * Template Name: Home Page
  4. * The events page template.
  5. *
  6. *
  7. * @package WordPress
  8. * @subpackage
  9. * @since
  10. */
  11.  
  12. get_header(); ?>
  13.  
  14. <div id="page-content">
  15. <div class="container">
  16. <div class="content">
  17.  
  18. <?php get_template_part( 'loop', 'home-carousel' ); ?>
  19.  
  20.  
  21. <?php
  22. /**
  23. * Loop for home page.
  24. *
  25. * @package WordPress
  26. * @subpackage themeName
  27. * @since themeName 1.0
  28. */
  29. ?>
  30.  
  31. <div class="more-about">
  32. <h2>TODAY'S NEWS:</h2>
  33. <h3><?php echo date('l jS F Y'); ?></h3>
  34. <div class="posts">
  35.  
  36. <?php
  37.  
  38. $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
  39.  
  40. $args = array(
  41. 'posts_per_page' => 3,
  42. 'post_status' => 'publish',
  43. 'ignore_sticky_posts' => 1,
  44. 'paged'=>$paged
  45.  
  46. );
  47.  
  48. query_posts( $args );
  49. ?>
  50. <?php if(have_posts()) : ?>
  51. <?php while ( have_posts() ) : the_post() ?>
  52. <div class="post">
  53.  
  54. <div class="main-img">
  55. <?php
  56. if ( has_post_thumbnail() ) { // check if the post has a Post Thumbnail assigned to it.
  57. the_post_thumbnail('standard-posts');
  58. }
  59. ?>
  60. </div>
  61. <!-- main-img -->
  62. <div class="content">
  63. <p class="date">
  64. <?php if(!function_exists('how_long_ago')){the_time('D'); } else { echo how_long_ago(get_the_time('U')); } ?>
  65. @ <?php the_date('h.i A'); ?>
  66.  
  67. </p>
  68. <!-- date -->
  69. <div class="social">
  70. <a href="#" class="twitter-icon-small">Twitter</a>
  71. <a href="#" class="facebook-icon-small">Facebook</a>
  72. </div>
  73. <!-- social -->
  74. <h4><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h4>
  75.  
  76. <?php the_excerpt(); ?>
  77.  
  78. <div class="related">
  79. <h5>RELATED STORIES:</h5>
  80. <div class="stories">
  81. <?php
  82. $postsId = explode(",", get_post_meta(get_the_ID(), 'tmc_related_posts', true));
  83. $args = array(
  84. 'post_type' => 'post',
  85. 'post_status' => "published",
  86. 'posts_per_page' => 3,
  87. 'post__in' => $postsId
  88. );
  89.  
  90. $related = new WP_Query($args);
  91. ?>
  92. <?php if($related->have_posts()) : ?>
  93. <?php while($related->have_posts()) : $related->the_post() ?>
  94. <p class="story">
  95. <span class="date"> <?php the_time('j M Y') ?></span>
  96. <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
  97. </p>
  98. <?php endwhile; ?>
  99. <?php endif; ?>
  100.  
  101. </div>
  102. <!-- sotries -->
  103. </div>
  104. <!-- related -->
  105. </div>
  106. <!-- content -->
  107. </div>
  108. <!-- post -->
  109.  
  110. <?php endwhile; ?>
  111.  
  112.  
  113. <?php if(function_exists('wp_paginate')) {
  114. wp_paginate();
  115. } ?>
  116.  
  117. <?php endif; ?>
  118. <?php wp_reset_query(); ?>
  119. </div>
  120. <!-- posts -->
  121. </div>
  122. <!-- more-about -->
  123.  
  124. <?php get_template_part( 'loop', 'today-stories' ); ?>
  125.  
  126. </div>
  127. <!-- content -->
  128.  
  129. </div>
  130. <!-- container -->
  131. </div>
  132. <!-- PAGE-CONTENT -->
  133.  
  134. <?php get_footer(); ?>
Add Comment
Please, Sign In to add comment