/** * Expands the body classes added by WordPress. <br /> * Only called by `add_filter('body_class','d7_body_classes');` * * ### Added classes * * `.post_type-{post_type}` * * `.post_name-{post_name}` * * `.taxonomy-{tax_name}` * * `.taxonomy_term-{tax_term_slug}` * * `.taxonomy_id-{tax_id}` * * `.taxonomy_term_id-{tax_term_id}` * * @package d7 * @subpackage boilerplate-theme_filters+hooks * * @internal Called by `body_class` filter * */ function d7_body_classes($classes, $class = '') { global $wp_query; if (isset($wp_query->queried_object)) { // Post type if (isset($wp_query->queried_object->post_type)) { $classes[] = 'post_type-' . $wp_query->queried_object->post_type; } // Post name if (isset($wp_query->queried_object->post_name)) { $classes[] = 'post_name-' . $wp_query->queried_object->post_name; } // Taxonomy if (isset($wp_query->queried_object->taxonomy)) { $classes[] = 'taxonomy-' . $wp_query->queried_object->taxonomy; } // Taxonomy term if (isset($wp_query->queried_object->taxonomy)) { $classes[] = 'taxonomy_term-' . $wp_query->queried_object->slug; } // Taxonomy ID if (isset($wp_query->queried_object->cat_ID)) { $classes[] = 'taxonomy_id-' . $wp_query->queried_object->cat_ID; } // Taxonomy term ID if (isset($wp_query->queried_object->term_id)) { $classes[] = 'taxonomy_term_id-' . $wp_query->queried_object->term_id; } } // if isset // Has post thumbnail or other acf images, add classes for those if (!d7_is_listing()) { $classes = d7_post_image_classes($classes); } // Has comments or not if (comments_open() && get_comments_number()) { $classes[] = "has-comments"; } else { $classes[] = "no-comments"; } // Comments open/closed if (comments_open()) { $classes[] = "can-comment"; } // Classes for sidebars if (function_exists('d7_sidebar_classes')) { $classes[] = d7_sidebar_classes(); } return $classes; // return the $classes array }
* Include the post type-specific template for the content. If you want to * use this in a child theme, then include a file called called content-___.php * (where ___ is the post type) and that will be used instead. For post type content layout * create a new partials/content-POSTTYPE.php file. If none is found content.php will be used. * * partials/listing is used on archives and search results, while content is used for * full content post/page views. */ if (d7_is_listing()) { get_template_part('partials/listing', get_post_type()); } else { get_template_part('partials/content', get_post_type()); } } // For listings, add a but of markup if (d7_is_listing()) { echo '</div>'; } // Pagination get_template_part('partials/pagination', get_post_type()); } else { // If no content, include the "No posts found" template. get_template_part('partials/content', 'none'); } ?> </section><!-- .l-content--> <?php get_sidebar(get_post_type()); ?>