Advertisement
catchmahesh

front-page.php Display 5 posts in static homepage

Aug 13th, 2016
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The template for displaying all pages.
  4.  *
  5.  * This is the template that displays all pages by default.
  6.  * Please note that this is the WordPress construct of pages
  7.  * and that other 'pages' on your WordPress site will use a
  8.  * different template.
  9.  *
  10.  * @package Catch Themes
  11.  * @subpackage Catch_Box
  12.  * @since Catch Box 1.0
  13.  */
  14.  
  15. get_header();
  16. //Getting data from Theme Options Panel
  17. global $catchbox_options_settings;
  18. $options = $catchbox_options_settings; ?>
  19.  
  20.                 <?php while ( have_posts() ) : the_post(); ?>
  21.  
  22.                     <?php get_template_part( 'content', 'page' ); ?>
  23.  
  24.                     <?php
  25.                     // If comments are open or we have at least one comment, load up the comment template
  26.                     if ( ( comments_open() || '0' != get_comments_number() ) && ( $options[ 'commenting_setting' ] == 'default' ) ) {
  27.                         comments_template( '', true );
  28.                     } ?>
  29.  
  30.                 <?php endwhile; // end of the loop. ?>
  31.  
  32.         <?php
  33.             $args = array(
  34.                 'post_type' => 'post',
  35.                 'posts_per_page' => 5
  36.                 );
  37.  
  38.             $wp_query = new WP_Query( $args );
  39.             while ( have_posts() ) : the_post();
  40.  
  41.                 get_template_part( 'content', 'post' );
  42.  
  43.             endwhile; // end of the loop.
  44.             /* Restore original Post Data */
  45.             wp_reset_postdata();
  46.         ?>
  47.  
  48.         </div><!-- #content -->
  49.  
  50.         <?php
  51.         /**
  52.          * catchbox_after_content hook
  53.          *
  54.          */
  55.         do_action( 'catchbox_after_content' ); ?>
  56.  
  57.     </div><!-- #primary -->
  58.  
  59.     <?php
  60.     /**
  61.      * catchbox_after_primary hook
  62.      *
  63.      */
  64.     do_action( 'catchbox_after_primary' ); ?>
  65.  
  66. <?php get_sidebar(); ?>
  67.  
  68. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement