/** * Load the page content view based on the currently-queried object. */ function boilerplate_the_queried_page() { $queried_object = get_queried_object(); if ($queried_object instanceof WP_Post) { if ('page' === $queried_object->post_type && !empty($queried_object->post_content)) { setup_postdata($queried_object); boilerplate_get_template_view('content', 'page'); wp_reset_postdata(); } } }
* we can put the focus entirely on the page specific markup and loop, * simplifying our templates. * * @link http://roots.io/an-introduction-to-the-roots-theme-wrapper/ * * @package Boilerplate\Templates */ use Roots\Sage\Wrapper; boilerplate_get_template_view('head'); ?> <body <?php body_class(); ?> role="document"> <?php do_action('get_header'); boilerplate_get_template_view('site', 'header'); ?> <main id="content" role="main"> <?php include Wrapper\template_path(); ?> </main> <?php boilerplate_get_template_view('site', 'footer'); do_action('get_footer'); wp_footer(); ?> </body> </html>
<?php /** * File: Main Template * * This is the most generic template file in a WordPress theme and one * of the two required files for a theme (the other being style.css). * It is used to display a page when nothing more specific matches a query, * e.g., it puts together the home page when no home.php file exists. * * @package Boilerplate\Templates */ if (have_posts()) { while (have_posts()) { the_post(); boilerplate_get_template_view('content', get_post_type() !== 'post' ? get_post_type() : get_post_format()); } if ($wp_query->max_num_pages > 1) { ?> <nav> <ul> <li><?php next_posts_link(__('← Older posts', 'boilerplate')); ?> </li> <li><?php previous_posts_link(__('Newer posts →', 'boilerplate')); ?> </li> </ul> </nav>
<?php /** * File: Default Entry Content * * @package Boilerplate\Templates */ ?> <div class="o-content"> <?php if (is_search()) { the_excerpt(); } else { the_content(); // Entry Pagination wp_link_pages(['before' => '<nav>', 'after' => '</nav>']); boilerplate_get_template_view('content', 'attachments'); } ?> </div>