Ejemplo n.º 1
0
 /**
  * Stack: Posts
  */
 function franz_stack_posts($args = array())
 {
     global $franz_settings, $franz_no_default_thumb;
     $franz_no_default_thumb = true;
     if ('page' == get_option('show_on_front') && $franz_settings['disable_front_page_blog']) {
         return;
     }
     $defaults = array('title' => __('Latest Articles', 'franz-josef'), 'description' => '', 'post_type' => array('post'), 'posts_per_page' => get_option('posts_per_page'), 'orderby' => 'date', 'order' => 'DESC', 'ignore_sticky_posts' => false);
     $args = wp_parse_args($args, $defaults);
     $query_args = array('post_type' => $args['post_type'], 'posts_per_page' => $args['posts_per_page'], 'orderby' => $args['orderby'], 'order' => $args['order'], 'ignore_sticky_posts' => $args['ignore_sticky_posts'], 'paged' => get_query_var('paged'));
     if (get_option('show_on_front') == 'page') {
         $query_args['ignore_sticky_posts'] = true;
         $query_args['paged'] = get_query_var('page');
     }
     if ($franz_settings['slider_type'] == 'categories' && $franz_settings['slider_exclude_categories'] != 'disabled') {
         $query_args['category__not_in'] = franz_object_id($franz_settings['slider_specific_categories'], 'category');
     }
     if ($franz_settings['frontpage_posts_cats']) {
         $query_args['category__in'] = franz_object_id($franz_settings['frontpage_posts_cats'], 'category');
     }
     $posts = new WP_Query($query_args);
     ?>
 <?php 
 }
Ejemplo n.º 2
0
/**
 * Exclude posts that belong to the categories displayed in slider from the posts listing
 */
function franz_exclude_slider_categories($query)
{
    global $franz_settings, $franz_defaults, $franz_slider_request;
    if ($franz_settings['slider_type'] != 'categories') {
        return;
    }
    if (is_admin()) {
        return;
    }
    if ($franz_slider_request) {
        return;
    }
    if ($franz_settings['slider_exclude_categories'] != $franz_defaults['slider_exclude_categories']) {
        if ($franz_settings['slider_exclude_categories'] == 'everywhere' || $franz_settings['slider_exclude_categories'] == 'homepage' && $query->is_home()) {
            $query->set('category__not_in', franz_object_id($franz_settings['slider_specific_categories'], 'category'));
        }
    }
}
Ejemplo n.º 3
0
    /**
     * Stack: Posts
     */
    function franz_stack_posts($args = array())
    {
        global $franz_settings, $franz_no_default_thumb;
        $franz_no_default_thumb = true;
        if ('page' == get_option('show_on_front') && $franz_settings['disable_front_page_blog']) {
            return;
        }
        $defaults = array('title' => __('Latest Articles', 'franz-josef'), 'description' => '', 'post_type' => array('post'), 'posts_per_page' => get_option('posts_per_page'), 'orderby' => 'date', 'order' => 'DESC', 'ignore_sticky_posts' => false);
        $args = wp_parse_args($args, $defaults);
        $query_args = array('post_type' => $args['post_type'], 'posts_per_page' => $args['posts_per_page'], 'orderby' => $args['orderby'], 'order' => $args['order'], 'ignore_sticky_posts' => $args['ignore_sticky_posts'], 'paged' => get_query_var('paged'));
        if (get_option('show_on_front') == 'page') {
            $query_args['ignore_sticky_posts'] = true;
            $query_args['paged'] = get_query_var('page');
        }
        if ($franz_settings['slider_type'] == 'categories' && $franz_settings['slider_exclude_categories'] != 'disabled') {
            $query_args['category__not_in'] = franz_object_id($franz_settings['slider_specific_categories'], 'category');
        }
        if ($franz_settings['frontpage_posts_cats']) {
            $query_args['category__in'] = franz_object_id($franz_settings['frontpage_posts_cats'], 'category');
        }
        $posts = new WP_Query($query_args);
        ?>
	<div class="posts-list highlights" id="posts-stack">
        <div class="container">
            <h2 class="highlight-title"><?php 
        echo $args['title'];
        ?>
</h2>
            <?php 
        echo wpautop($args['description']);
        ?>
            <div class="row items-container">
            	<?php 
        while ($posts->have_posts()) {
            $posts->the_post();
            if ($posts->current_post == 0 && !$franz_settings['disable_full_width_post']) {
                $col = 'col-md-12';
                $image_size = 'full';
            } elseif ($franz_settings['front_page_blog_columns'] == 2) {
                $col = 'col-sm-6';
                $image_size = 'franz-medium';
            } elseif ($franz_settings['front_page_blog_columns'] == 3) {
                $col = 'col-sm-4';
                $image_size = 'franz-medium';
            } elseif ($franz_settings['front_page_blog_columns'] == 4) {
                $col = 'col-md-3 col-sm-6';
                $image_size = 'medium';
            }
            ?>
                    <div class="item-wrap <?php 
            echo $col;
            ?>
" id="item-<?php 
            the_ID();
            ?>
">
                        <div <?php 
            post_class('item');
            ?>
>
                        	<?php 
            if (has_post_thumbnail()) {
                ?>
                            	<a href="<?php 
                the_permalink();
                ?>
"><?php 
                the_post_thumbnail($image_size);
                ?>
</a>
                            <?php 
            }
            ?>
                            <h3 class="item-title"><a href="<?php 
            the_permalink();
            ?>
"><?php 
            the_title();
            ?>
</a></h3>
                            <div class="excerpt"><?php 
            the_excerpt();
            ?>
</div>
                            <?php 
            franz_stack_posts_meta();
            ?>
                        </div>
                    </div>
                <?php 
        }
        wp_reset_postdata();
        ?>
                
            </div>
            
            <?php 
        $args = apply_filters('franz_posts_stack_nav_args', array('current' => max(1, $posts->query['paged']), 'total' => $posts->max_num_pages, 'add_fragment' => '#posts-stack'), $posts);
        franz_posts_nav($args);
        ?>
            
        </div>
    </div>
    <?php 
    }