Example #1
0
$paged = get_query_var('paged') ? get_query_var('paged') : 1;
$args = array('post_type' => array('portfolio'), 'posts_per_page' => $candy_options['portfolio-per-page'], 'order' => $candy_options['portfolio-post-order'], 'orderby' => $candy_options['portfolio-post-orderby'], 'post__not_in' => explode(',', $candy_options['portfolio-post-exclude']), 'paged' => $paged);
$query = new WP_Query($args);
?>
	<div id="primary" class="portfolio content-area">
        <main id="main" class="container<?php 
if ($candy_options['portfolio-fullwidth'] == '1') {
    echo '-fluid ';
}
?>
 site-main margin-90" role="main">
        	<?php 
if ($candy_options['portfolio-filter'] == '1') {
    ?>
<div class="portfolio-filter text-left"><?php 
    echo portfolio_filter();
    ?>
</div><?php 
}
?>
            <div class="row">
            	<div class="col-xs-12">
                    <div id="portfolio-page" class="row portfolio-page <?php 
if ($candy_options['portfolio-fullwidth'] == '1') {
    echo 'portfolio-full';
}
if ($candy_options['portfolio-gutter'] == '1') {
    echo ' portfolio-guttered';
}
if ($candy_options['portfolio-fullwidth'] == '1' && $candy_options['portfolio-gutter'] == '0') {
    echo '';
Example #2
0
    public static function agni_posts($atts = null, $content = null)
    {
        // Prepare error var
        $error = null;
        // Parse attributes
        $atts = shortcode_atts(array('posttype' => '', 'blog_style' => '', 'blog_categories' => '', 'portfolio_categories' => '', 'fullwidth' => '', 'gutter' => '', 'filter' => '', 'align' => '', 'posts_per_page' => get_option('posts_per_page'), 'order' => 'DESC', 'order_by' => 'date', 'pagination' => '', 'post_not_in' => '', 'ignore_sticky' => ''), $atts, 'posts');
        global $blog_style;
        $blog_style = $atts['blog_style'];
        $tax_args = $carousel = $blog_cat = '';
        $ignore_sticky = $atts['ignore_sticky'];
        $order = sanitize_key($atts['order']);
        $orderby = sanitize_key($atts['order_by']);
        $post_type = $atts['posttype'];
        $posts_per_page = intval($atts['posts_per_page']);
        $blog_categories = $atts['blog_categories'];
        $portfolio_categories = $atts['portfolio_categories'];
        $exclude_ids = explode(',', $atts['post_not_in']);
        if ($post_type == 'portfolio') {
            $category = $portfolio_categories;
        } else {
            $category = $blog_categories;
        }
        // Set up initial query for post
        if ($atts['pagination'] == 'yes') {
            $paged = get_query_var('paged') ? get_query_var('paged') : 1;
        } else {
            $paged = '';
        }
        // If taxonomy attributes, create a taxonomy query
        if (!empty($portfolio_categories) && $post_type == 'portfolio') {
            $tax_args = array(array('taxonomy' => 'types', 'field' => 'slug', 'terms' => explode(',', $category)));
        } else {
            $blog_cat = $category;
        }
        $args = array('category_name' => $blog_cat, 'order' => $order, 'orderby' => $orderby, 'post_type' => $post_type, 'posts_per_page' => $posts_per_page, 'post__not_in' => $exclude_ids, 'ignore_sticky_posts' => $ignore_sticky, 'paged' => $paged, 'tax_query' => $tax_args);
        $filter = (bool) ($atts['filter'] === 'yes') ? true : false;
        $pagination = (bool) ($atts['pagination'] === 'yes') ? true : false;
        global $post, $candy_options;
        // Save original posts
        global $shortcodeposts;
        $original_posts = $shortcodeposts;
        // Query posts
        $shortcodeposts = new WP_Query($args);
        // Buffer output
        ob_start();
        if ($post_type == 'portfolio') {
            ?>
        	<?php 
            if ($atts['filter'] == 'yes') {
                ?>
<div class="portfolio-filter text-<?php 
                echo $atts['align'];
                ?>
"><?php 
                echo portfolio_filter();
                ?>
</div><?php 
            }
            ?>

            <div id="portfolio-page" class="row portfolio-page <?php 
            if ($atts['fullwidth'] == 'yes') {
                echo 'portfolio-full';
            }
            if ($atts['gutter'] == 'yes') {
                echo ' portfolio-guttered';
            }
            if ($atts['fullwidth'] == 'yes' && !empty($atts['gutter'])) {
                echo '';
            } else {
                echo ' no-margin';
            }
            ?>
">

                <?php 
            // The Loop
            if ($shortcodeposts->have_posts()) {
                while ($shortcodeposts->have_posts()) {
                    $shortcodeposts->the_post();
                    $portfolio_ajax_choice = get_post_meta($post->ID, 'portfolio_ajax_choice', true);
                    $portfolio_thumbnail_width = get_post_meta($post->ID, 'portfolio_thumbnail_width', true);
                    $terms = get_the_terms($post->ID, 'types');
                    if ($terms && !is_wp_error($terms)) {
                        $links = array();
                        foreach ($terms as $term) {
                            $links[] = $term->name;
                        }
                        $links = str_replace(' ', '-', $links);
                        $tax = join(" ", $links);
                    } else {
                        $tax = '';
                    }
                    ?>

                    <div id="post-<?php 
                    the_ID();
                    ?>
" class="<?php 
                    echo strtolower($tax);
                    ?>
 <?php 
                    //if( $candy_options['portfolio-fullwidth'] == '1' ){ echo 'col-xs-12 col-sm-6 col-md-3'; }else{ echo 'col-xs-12 col-sm-6 col-md-4'; }
                    ?>
 <?php 
                    if ($portfolio_thumbnail_width == 'width2x') {
                        echo 'width2';
                    }
                    ?>
 white all portfolio-post portfolio-thumbnail <?php 
                    if ($atts['gutter'] != '1') {
                        echo 'no-padding';
                    }
                    ?>
">
                        <figure>
                            <div class="thumb-image">
                                 <?php 
                    the_post_thumbnail();
                    ?>
                            </div>
                            <figcaption class="portfolio-thumbnail-attachments text-right">
<!--                                <h5 class="heading heading-underlined portfolio-thumbnail-heading">--><?php 
                    //the_title();
                    ?>
<!--</h5>-->
                                <ul class="portfolio-category list-inline">
                                    <?php 
                    $terms = get_the_terms($post->ID, 'types');
                    if ($terms && !is_wp_error($terms)) {
                        foreach ($terms as $term) {
                            echo '<li>' . $term->name . '</li>';
                        }
                    }
                    ?>
                                </ul>
								<a <?php 
                    if ($portfolio_ajax_choice == 'on') {
                        echo ' class="portfolio-single-link"';
                    }
                    ?>
 href="<?php 
                    the_permalink();
                    ?>
">Ver más</a>
								<a href="#"></a>
                            </figcaption>
                        </figure>
                    </div>


                    <?php 
                }
            }
            // Reset Post Data
            wp_reset_postdata();
            ?>
        	</div>

			<?php 
            if ($atts['pagination'] == 'yes') {
                ?>
				<div class="margin-top-90">
                	<?php 
                agni_page_navigation($shortcodeposts);
                ?>
                </div>
			<?php 
            }
            ?>

		<?php 
        } else {
            ?>

			<?php 
            switch ($atts['blog_style']) {
                case '1':
                    ?>
                    <div class="row blog-masonry margin-top-100 margin-bottom-70">

                        <?php 
                    if ($shortcodeposts->have_posts()) {
                        ?>
                            <?php 
                        /* Start the Loop */
                        ?>
                            <?php 
                        while ($shortcodeposts->have_posts()) {
                            $shortcodeposts->the_post();
                            ?>

                                <div class="col-xs-12 col-sm-6 col-md-4 blog-content">
                                    <?php 
                            /* Include the Post-Format-specific template for the content.
                             * If you want to override this in a child theme, then include a file
                             * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                             */
                            get_template_part('content', get_post_format());
                            ?>
                                </div>
                            <?php 
                        }
                        ?>
                        <?php 
                    } else {
                        ?>

                            <?php 
                        get_template_part('content', 'none');
                        ?>
                        <?php 
                    }
                    ?>
                    </div>

                    <?php 
                    if ($atts['pagination'] == 'yes') {
                        if ($candy_options['blog-pagination'] == '2') {
                            candy_paging_nav();
                        } else {
                            agni_page_navigation('');
                        }
                    }
                    ?>

                    <?php 
                    break;
                case '2':
                    ?>
                    <div class="row margin-top-140 margin-bottom-70">
                        <div class="col-sm-12 col-md-8">
                            <div class="row blog-masonry">
                                <?php 
                    if ($shortcodeposts->have_posts()) {
                        ?>

                                    <?php 
                        /* Start the Loop */
                        ?>
                                    <?php 
                        while ($shortcodeposts->have_posts()) {
                            $shortcodeposts->the_post();
                            ?>
                                        <div class="col-xs-12 col-sm-6 col-md-6 blog-content">
                                        <?php 
                            /* Include the Post-Format-specific template for the content.
                             * If you want to override this in a child theme, then include a file
                             * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                             */
                            get_template_part('content', get_post_format());
                            ?>
                                        </div>
                                    <?php 
                        }
                        ?>

                                <?php 
                    } else {
                        ?>

                                    <?php 
                        get_template_part('content', 'none');
                        ?>

                                <?php 
                    }
                    ?>
                            </div>

							<?php 
                    if ($atts['pagination'] == 'yes') {
                        if ($candy_options['blog-pagination'] == '2') {
                            candy_paging_nav();
                        } else {
                            agni_page_navigation('');
                        }
                    }
                    ?>

                        </div>
                        <div class="col-sm-12 col-md-4">
                            <?php 
                    get_sidebar();
                    ?>
                        </div>
                    </div>
                <?php 
                    break;
                case '3':
                    ?>
                    <div class="row">
                        <div class="col-sm-12 col-md-12 margin-bottom-140 no-padding">
                            <div class="blog-minimal">
                                <?php 
                    if ($shortcodeposts->have_posts()) {
                        ?>

                                    <?php 
                        /* Start the Loop */
                        ?>
                                    <?php 
                        while ($shortcodeposts->have_posts()) {
                            $shortcodeposts->the_post();
                            ?>
                                        <?php 
                            /* Include the Post-Format-specific template for the content.
                             * If you want to override this in a child theme, then include a file
                             * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                             */
                            get_template_part('content', 'modern');
                            ?>
                                    <?php 
                        }
                        ?>

                                <?php 
                    } else {
                        ?>

                                    <?php 
                        get_template_part('content', 'none');
                        ?>

                                <?php 
                    }
                    ?>

                            </div>
                            <?php 
                    if ($atts['pagination'] == 'yes') {
                        if ($candy_options['blog-pagination'] == '2') {
                            candy_paging_nav();
                        } else {
                            agni_page_navigation('');
                        }
                    }
                    ?>
                        </div>
                    </div>
                 <?php 
                    break;
                default:
                    ?>
					<div class="row margin-bottom-70">
						<div class="col-sm-12 col-md-8 blog-classic">
							<?php 
                    if ($shortcodeposts->have_posts()) {
                        ?>

								<?php 
                        /* Start the Loop */
                        ?>
								<?php 
                        while ($shortcodeposts->have_posts()) {
                            $shortcodeposts->the_post();
                            ?>
								<?php 
                            /* Include the Post-Format-specific template for the content.
                             * If you want to override this in a child theme, then include a file
                             * called content-___.php (where ___ is the Post Format name) and that will be used instead.
                             */
                            get_template_part('content', 'classic');
                            ?>
								<?php 
                        }
                        ?>

							<?php 
                    } else {
                        ?>

								<?php 
                        get_template_part('content', 'none');
                        ?>

							<?php 
                    }
                    ?>
							<?php 
                    if ($atts['pagination'] == 'yes') {
                        if ($candy_options['blog-pagination'] == '2') {
                            candy_paging_nav();
                        } else {
                            agni_page_navigation('');
                        }
                    }
                    ?>
						</div>
						<div class="col-sm-12 col-md-4">
							<?php 
                    get_sidebar();
                    ?>
						</div>
					</div>
                <?php 
            }
            ?>

		<?php 
        }
        $output = ob_get_contents();
        ob_end_clean();
        // Return original posts
        $posts = $original_posts;
        // Reset the query
        wp_reset_postdata();
        return $output;
    }