Example #1
0
function outdoor_last_posts_shortcode($atts, $content = '')
{
    extract(shortcode_atts(array('ids' => '', 'limit' => 10, 'category_ids' => '', 'order' => 'DESC', 'order_by' => 'post_date', 'single' => 'false'), $atts));
    $args = array('numberposts' => $limit, 'orderby' => $order_by, 'order' => $order, 'suppress_filters' => false);
    if ('' != $ids) {
        $array_ids = explode(',', $ids);
        $args['post__in'] = $array_ids;
    }
    if ('' != $category_ids) {
        $args['category'] = $category_ids;
    }
    $posts = get_posts($args);
    $data_item_attr = 'false' == $single ? 'data-item-max="3" data-item-width="350"' : '';
    $slider_class = 'false' == $single ? 'post-slider' : 'posted-slider';
    $slider_foo = 'false' == $single ? '1' : '2';
    ob_start();
    // End php code
    ?>

    <?php 
    if ($posts) {
        ?>

    <div class="col-xs-12">
        <div class="<?php 
        echo esc_attr($slider_class);
        ?>
">
            <div class="row list-carousel responsive slider-foo-<?php 
        echo esc_attr($slider_foo);
        ?>
">

                <div class="preloader">
                    <div class="preload-img"></div>
                </div>

                <div class="carousel-box foo<?php 
        echo esc_attr($slider_foo);
        ?>
" <?php 
        echo $data_item_attr;
        ?>
>

                    <?php 
        foreach ($posts as $post) {
            $thumb = get_the_post_thumbnail($post->ID, 'full', array('class' => outdoor_retina_class(), 'alt' => $post->post_title));
            ?>

                        <?php 
            if ('false' == $single) {
                ?>

                            <div class="col-xs-12 col-sm-4 col-md-3">
                                <div class="img-block text-center-sm text-center-xs">
                                    <?php 
                if ($thumb) {
                    echo $thumb;
                }
                ?>
                                </div>
                                <h6><a href="<?php 
                echo esc_url(get_the_permalink($post->ID));
                ?>
"><?php 
                echo $post->post_title;
                ?>
</a></h6>
                                <p class="data-post"><?php 
                outdoor_post_meta($post->ID, true);
                ?>
</p>
                                <p class="text-post"><?php 
                echo mb_substr(strip_tags($post->post_content), 0, 120);
                ?>
</p>
                                <a href="<?php 
                echo esc_url(get_the_permalink($post->ID));
                ?>
" class="btn-default"><?php 
                _e('Read More', 'outdoor');
                ?>
 <i class="fa fa-angle-right"></i></a>
                            </div>

                        <?php 
            } else {
                ?>

                            <div class="col-xs-12 col-sm-4 col-md-3">
                                <div class="row">
                                    <?php 
                if ($thumb) {
                    ?>
                                    <div class="col-sm-5 col-xs-12 text-center-sm text-center-xs">
                                        <div class="img-block">
                                            <?php 
                    echo $thumb;
                    ?>
                                        </div>
                                    </div>
                                    <?php 
                }
                ?>
                                    <div class="col-sm-7 col-xs-12">
                                        <h2><a href="<?php 
                echo esc_url(get_the_permalink($post->ID));
                ?>
"><?php 
                echo $post->post_title;
                ?>
</a></h2>
                                        <div class="post-info">
                                            <?php 
                outdoor_post_meta($post->ID, true);
                ?>
                                        </div>
                                        <p class="text-post"><?php 
                echo strip_tags($post->post_content);
                ?>
</p>
                                        <a href="<?php 
                echo esc_url(get_the_permalink($post->ID));
                ?>
" class="btn-default"><?php 
                _e('Read More', 'outdoor');
                ?>
 <i class="fa fa-angle-right"></i></a>
                                    </div>
                                </div>
                            </div>

                        <?php 
            }
            ?>

                    <?php 
        }
        ?>
                    <?php 
        wp_reset_postdata();
        ?>

                </div>
                <div class="clearfix"></div>

                <?php 
        if ('true' == $single) {
            ?>
                    <button class="prev"><i class="fa fa-angle-left"></i></button>
                    <button class="next"><i class="fa fa-angle-right"></i></button>
                <?php 
        }
        ?>
            </div>
            <?php 
        if ('false' == $single) {
            ?>
                <button class="prev"><i class="fa fa-angle-left"></i></button>
                <button class="next"><i class="fa fa-angle-right"></i></button>
            <?php 
        }
        ?>
        </div><!-- /post-slider -->
    </div>

    <?php 
    } else {
        ?>
        <p><?php 
        _e('Posts not found', 'outdoor');
        ?>
</p>
    <?php 
    }
    ?>

    <?php 
    // Start php code
    return ob_get_clean();
}
Example #2
0
" <?php 
post_class('col-xs-12 posts');
?>
>

    <?php 
if (is_single()) {
    the_title('<h1 class="entry-title">', '</h1>');
} else {
    the_title(sprintf('<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url(get_permalink())), '</a></h2>');
}
?>

    <div class="post-info">
        <?php 
outdoor_post_meta();
?>
    </div>
    <div class="clearfix"></div>

    <?php 
if ($post_gallery || $thumbnail_url) {
    ?>

        <!-- carousel -->
        <div class="wrapper-carusel inpost-slider">
            <div class="carusel-3">
                <div class="row list-carousel responsive slider-foo-3 ">

                    <div class="preloader">
                        <div class="preload-img"></div>