Ejemplo n.º 1
0
/**
 * Sets the correct layout for posts
 *
 * @since Total 1.0.0
 */
function wpex_post_layout($post_id = '')
{
    // Get ID if not defined
    $post_id = $post_id ? $post_id : wpex_get_the_id();
    // Define variables
    $class = 'right-sidebar';
    $meta = get_post_meta($post_id, 'wpex_post_layout', true);
    // Check meta first to override and return (prevents filters from overriding meta)
    if ($meta) {
        return $meta;
    }
    // Singular Page
    if (is_page()) {
        // Blog template
        if (is_page_template('templates/blog.php')) {
            $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
        }
        // Landing Page
        if (is_page_template('templates/landing-page.php')) {
            $class = 'full-width';
        } elseif (is_attachment()) {
            $class = 'full-width';
        } else {
            $class = wpex_get_mod('page_single_layout', 'right-sidebar');
        }
    } elseif (is_singular('post')) {
        $class = wpex_get_mod('blog_single_layout', 'right-sidebar');
    } elseif (is_singular('attachment')) {
        $class = 'full-width';
    } elseif (is_home()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
    } elseif (is_search()) {
        $class = wpex_get_mod('search_layout', 'right-sidebar');
    } elseif (is_category()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
        $term = get_query_var('cat');
        $term_data = get_option("category_{$term}");
        if ($term_data) {
            if (!empty($term_data['wpex_term_layout'])) {
                $class = $term_data['wpex_term_layout'];
            }
        }
    } elseif (wpex_is_blog_query()) {
        $class = wpex_get_mod('blog_archives_layout', 'right-sidebar');
    } elseif (is_404()) {
        $class = 'full-width';
    } else {
        $class = 'right-sidebar';
    }
    // Class should never be empty
    if (empty($class)) {
        $class = 'right-sidebar';
    }
    // Apply filters for child theme editing
    $class = apply_filters('wpex_post_layout_class', $class);
    // Return correct classname
    return $class;
}
Ejemplo n.º 2
0
			<div id="content" class="site-content">

				<?php 
wpex_hook_content_top();
?>

				<?php 
// Display posts if there are in fact posts to display
if (have_posts()) {
    /*-----------------------------------------------------------------------------------*/
    /*  - Standard Post Type (BLOG)
    				/*  - See framework/conditionals.php
    				/*  - Blog entries use partials/blog/blog-entry.php for their output
    				/*-----------------------------------------------------------------------------------*/
    if (wpex_is_blog_query()) {
        ?>

						<div id="blog-entries" class="<?php 
        wpex_blog_wrap_classes();
        ?>
">

							<?php 
        // Define counter for clearing floats
        $wpex_count = 0;
        ?>

							<?php 
        // Start div loop
        while (have_posts()) {