Exemplo n.º 1
0
/**
 * The Shortcode
 */
function ebor_faq_shortcode($atts)
{
    extract(shortcode_atts(array('pppage' => '8', 'filter' => 'all', 'part' => 'excerpt'), $atts));
    $query_args = array('post_type' => 'faq', 'posts_per_page' => $pppage);
    if (!($filter == 'all')) {
        if (function_exists('icl_object_id')) {
            $filter = (int) icl_object_id($filter, 'faq_category', true);
        }
        $query_args['tax_query'] = array(array('taxonomy' => 'faq_category', 'field' => 'id', 'terms' => $filter));
    }
    $block_query = new WP_Query($query_args);
    ob_start();
    ?>
	
	<div class="row">
		<?php 
    if ($block_query->have_posts()) {
        while ($block_query->have_posts()) {
            $block_query->the_post();
            /**
             * Get blog posts by blog layout.
             */
            get_template_part('loop/content-faq', $part);
        }
    } else {
        /**
         * Display no posts message if none are found.
         */
        get_template_part('loop/content', 'none');
    }
    ?>
	
	</div>
	
	<?php 
    /**
     * Post pagination, use ebor_pagination() first and fall back to default
     */
    echo function_exists('ebor_pagination') ? ebor_pagination() : posts_nav_link();
    ?>

<?php 
    $output = ob_get_contents();
    ob_end_clean();
    return $output;
}
Exemplo n.º 2
0
    while (have_posts()) {
        the_post();
        /**
         * Get blog posts by blog layout.
         */
        get_template_part('loop/content', 'post');
    }
} else {
    /**
     * Display no posts message if none are found.
     */
    get_template_part('loop/content', 'none');
}
?>
		
		</div>
		
		<?php 
/**
 * Post pagination, use ebor_pagination() first and fall back to default
 */
echo function_exists('ebor_pagination') ? ebor_pagination() : posts_nav_link();
?>
	
	</div>
	
	<?php 
get_sidebar();
?>

</div>
Exemplo n.º 3
0
<?php

global $wp_query;
if ($wp_query->max_num_pages <= 1) {
    return;
}
echo ebor_pagination($wp_query->max_num_pages);
Exemplo n.º 4
0
    function block($instance)
    {
        extract($instance);
        // Fix for pagination
        if (is_front_page()) {
            $paged = get_query_var('page') ? get_query_var('page') : 1;
        } else {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        }
        /**
         * Setup post query
         */
        $query_args = array('post_type' => 'post', 'posts_per_page' => $pppage, 'paged' => $paged);
        /**
         * Set up category query if needed
         */
        if (!($filter == 'all')) {
            if (function_exists('icl_object_id')) {
                $filter = (int) icl_object_id($filter, 'category', true);
            }
            $query_args['tax_query'] = array(array('taxonomy' => 'category', 'field' => 'id', 'terms' => $filter));
        }
        $blog_query = new WP_Query($query_args);
        ?>
	
		<?php 
        if ($type == 'blog') {
            ?>
		
			<div class="grid-blog col3">
			
				<?php 
            if ($blog_query->have_posts()) {
                while ($blog_query->have_posts()) {
                    $blog_query->the_post();
                    /**
                     * Get blog posts by blog layout.
                     */
                    get_template_part('loop/content', 'post');
                }
            } else {
                /**
                 * Display no posts message if none are found.
                 */
                get_template_part('loop/content', 'none');
            }
            ?>
			
			</div>
			
			<?php 
            /**
             * Post pagination, use ebor_pagination() first and fall back to default
             */
            echo function_exists('ebor_pagination') ? ebor_pagination($blog_query->max_num_pages) : posts_nav_link();
            wp_reset_query();
            ?>
			
		<?php 
        } elseif ($type == 'blogsidebar') {
            ?>
		
			<div class="row">
			
				<div class="col-sm-8 content">
				
					<div class="grid-blog col2">
					
						<?php 
            if ($blog_query->have_posts()) {
                while ($blog_query->have_posts()) {
                    $blog_query->the_post();
                    /**
                     * Get blog posts by blog layout.
                     */
                    get_template_part('loop/content', 'post');
                }
            } else {
                /**
                 * Display no posts message if none are found.
                 */
                get_template_part('loop/content', 'none');
            }
            ?>
					
					</div>
					
					<?php 
            /**
             * Post pagination, use ebor_pagination() first and fall back to default
             */
            echo function_exists('ebor_pagination') ? ebor_pagination($blog_query->max_num_pages) : posts_nav_link();
            wp_reset_query();
            ?>
				
				</div>
				
				<?php 
            get_sidebar();
            ?>
			
			</div>
			
		<?php 
        } else {
            ?>
		
			<div class="row">
			
				<div class="col-sm-8 content">
				  <div class="classic-blog">
				  
				    <?php 
            if ($blog_query->have_posts()) {
                while ($blog_query->have_posts()) {
                    $blog_query->the_post();
                    /**
                     * Get blog posts by blog layout.
                     */
                    get_template_part('loop/content', 'postclassic');
                }
            } else {
                /**
                 * Display no posts message if none are found.
                 */
                get_template_part('loop/content', 'none');
            }
            /**
             * Post pagination, use ebor_pagination() first and fall back to default
             */
            echo function_exists('ebor_pagination') ? ebor_pagination($blog_query->max_num_pages) : posts_nav_link();
            wp_reset_query();
            ?>
				
				  </div>
				</div>
				
				<?php 
            get_sidebar();
            ?>
			
			</div>
			
		<?php 
        }
        ?>
			
	<?php 
    }