Advertisement
sumakaki

index wordpress

Dec 18th, 2020
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.42 KB | None | 0 0
  1. <?php
  2. /**
  3.  * The main template file
  4.  *
  5.  * This is the most generic template file in a WordPress theme
  6.  * and one of the two required files for a theme (the other being style.css).
  7.  * It is used to display a page when nothing more specific matches a query.
  8.  * E.g., it puts together the home page when no home.php file exists.
  9.  *
  10.  * @link https://developer.wordpress.org/themes/basics/template-hierarchy/
  11.  *
  12.  * @package homes
  13.  */
  14.  
  15. get_header();
  16. ?>
  17.  
  18.     <main id="primary" class="site-main">
  19.         <?php $args = array('post_type' => 'house'); ?>
  20.         <?php $houses = get_posts($args); ?>
  21.         <?php
  22.         if ( $houses ) :
  23.  
  24.             if ( is_home() && ! is_front_page() ) :
  25.                 ?>
  26.                 <header>
  27.                     <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1>
  28.                 </header>
  29.                 <?php
  30.             endif;
  31.  
  32.             /* Start the Loop */
  33.             foreach ( $houses as $house ) :
  34.                 setup_postdata($post);
  35.  
  36.                 /*
  37.                  * Include the Post-Type-specific template for the content.
  38.                  * If you want to override this in a child theme, then include a file
  39.                  * called content-___.php (where ___ is the Post Type name) and that will be used instead.
  40.                  */
  41.                 get_template_part( 'template-parts/content', 'house' );
  42.  
  43.             endforeach;
  44.  
  45.             the_posts_navigation();
  46.  
  47.         else :
  48.  
  49.             get_template_part( 'template-parts/content', 'none' );
  50.  
  51.         endif;
  52.         wp_reset_postdata();
  53.         ?>
  54.  
  55.     </main><!-- #main -->
  56.  
  57. <?php
  58. get_sidebar();
  59. get_footer();
  60.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement