コード例 #1
0
    function shortcode($atts, $content)
    {
        extract(shortcode_atts(array('title' => '', 'desc' => '', 'cat' => '', 'show_title' => 'true', 'show_excerpt' => 'true', 'show_meta' => 'true', 'items' => 6, 'arrow_pos' => '', 'animation_type' => '', 'animation_duration' => 1, 'animation_delay' => 0, 'class' => ''), $atts));
        $args = array('post_type' => 'post', 'posts_per_page' => $items);
        if ($cat) {
            $args['cat'] = $cat;
        }
        global $venedor_settings;
        $posts = new WP_Query($args);
        if ($posts->have_posts()) {
            $count = 0;
            ob_start();
            ?>
            <?php 
            while ($posts->have_posts()) {
                $posts->the_post();
                global $post;
                global $previousday;
                unset($previousday);
                ?>
            <?php 
                $count++;
                ?>
                <div class="post-item">
                    <div class="inner">
                        <?php 
                if (has_post_thumbnail()) {
                    ?>
                        <div class="post-image">
                            <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_post_thumbnail('post-related');
                    ?>
</a>
                            <?php 
                    if ($venedor_settings['post-zoom']) {
                        ?>
                            <div class="figcaption">
                                <a class="btn btn-inverse zoom-button" href="<?php 
                        $thumbs = wp_get_attachment_image_src(get_post_thumbnail_id(), 'full');
                        echo $thumbs[0];
                        ?>
"><span class="fa fa-search"></span></a>
                                <a class="btn btn-inverse link-button" href="<?php 
                        the_permalink();
                        ?>
"><span class="fa fa-link fa-rotate-90"></span></a>
                            </div>
                            <?php 
                    }
                    ?>
                        </div>
                        <?php 
                }
                ?>

                        <?php 
                if ($show_title == 'true') {
                    ?>
                        <div class="post-title">
                            <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a>
                        </div>
                        <?php 
                }
                ?>

                        <?php 
                if ($show_excerpt == 'true') {
                    ?>
                            <?php 
                    echo '<p>' . venedor_excerpt(15, false) . '</p>';
                    ?>
                        <?php 
                }
                ?>

                        <?php 
                if ($show_meta == 'true') {
                    ?>
                        <div class="entry-meta clearfix">
                            <div class="left">
                                <a class="read-more" href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    _e('Read More', 'venedor');
                    ?>
</a>
                            </div>
                            <div class="right">
                                <span class="meta-date"><?php 
                    echo get_the_date('', $post);
                    ?>
</span>
                            </div>
                        </div>
                        <?php 
                }
                ?>
                    </div>
                </div>
            <?php 
            }
            ?>

            <?php 
            $html = ob_get_contents();
            ob_end_clean();
            ob_start();
            if ($count) {
                ?>
            <div class="entry-related related-slider <?php 
                echo $class;
                if (!$title) {
                    echo ' notitle';
                }
                ?>
 <?php 
                if ($arrow_pos) {
                    echo $arrow_pos;
                }
                ?>
 <?php 
                if ($desc) {
                    echo ' with-desc';
                }
                ?>
 <?php 
                if ($animation_type) {
                    echo 'animated';
                }
                ?>
"
                <?php 
                if ($animation_type) {
                    ?>
                 animation_type="<?php 
                    echo $animation_type;
                    ?>
" animation_duration="<?php 
                    echo $animation_duration;
                    ?>
" animation_delay="<?php 
                    echo $animation_delay;
                    ?>
"
                <?php 
                }
                ?>
>
                <?php 
                if ($title) {
                    ?>
<h2 class="entry-title"><?php 
                    echo $title;
                    ?>
</h2><?php 
                }
                ?>
                <?php 
                if ($desc) {
                    ?>
<div class="slider-desc"><?php 
                    echo $desc;
                    ?>
</div><?php 
                }
                ?>
                <div class="row"><div class="post-carousel owl-carousel">
                    <?php 
                echo $html;
                ?>
                </div></div>
            </div>
            <?php 
            }
            ?>

        <?php 
        }
        wp_reset_postdata();
        ?>

        <?php 
        $str = ob_get_contents();
        ob_end_clean();
        return $str;
    }
コード例 #2
0
ファイル: index.php プロジェクト: robwri32/garland
</div></div>
                                <div class="meta-item meta-comments"><div class="meta-inner"><span class="fa fa-comments"></span> <?php 
    comments_popup_link(__('0 Comments', 'venedor'), __('1 Comment', 'venedor'), '% ' . __('Comments', 'venedor'));
    ?>
</div></div>
                                <div class="meta-item meta-cats"><div class="meta-inner"><span class="fa fa-folder-open"></span> <?php 
    the_category(', ');
    ?>
</div></div>
                            </div>
                                        
                            <div class="entry-content">
                                
                            <?php 
    if ($venedor_settings['blog-excerpt']) {
        echo venedor_excerpt($venedor_settings['blog-excerpt-length']);
    } else {
        the_content('');
    }
    ?>
                        
                        <?php 
    if ($post_layout == 'small-alt' && ($slideshow_type == 'images' && has_post_thumbnail() || $slideshow_type == 'video' && get_post_meta($post->ID, 'video_code', true))) {
        ?>
                        </div>
                        <?php 
    }
    ?>
                            
                        </div>
                    </div>
コード例 #3
0
ファイル: functions.php プロジェクト: robwri32/garland
function venedor_featured_products_slider()
{
    $args = array('post_status' => 'publish', 'post_type' => 'product', 'ignore_sticky_posts' => 1, 'meta_key' => '_featured', 'meta_value' => 'yes', 'posts_per_page' => 8, 'orderby' => 'date', 'order' => 'desc', 'product_cat' => get_query_var('product_cat'));
    $products = new WP_Query($args);
    global $venedor_product_slider;
    if ($products->have_posts()) {
        ?>

        <div class="product-featured-slider owl-carousel">

            <?php 
        while ($products->have_posts()) {
            $products->the_post();
            if (!has_post_thumbnail()) {
                continue;
            }
            ?>

                <div class="container product-item product"><div class="row">

                    <div class="col-sm-5">
                    <?php 
            venedor_woocommerce_image();
            ?>
                    </div>

                    <div class="col-sm-7 product-details"><div class="inner">
                        <a href="<?php 
            the_permalink();
            ?>
">
                            <h3 class="product-name"><?php 
            the_title();
            ?>
</h3>
                        </a>
                        <div class="price-box"><?php 
            echo woocommerce_template_loop_price();
            ?>
</div>
                        <div class="product-desc"><?php 
            echo venedor_excerpt(50, false);
            ?>
</div>
                        <?php 
            global $product;
            if (!$product->is_in_stock()) {
                ?>

                            <a href="<?php 
                echo apply_filters('out_of_stock_add_to_cart_url', get_permalink($product->id));
                ?>
" class="button"><?php 
                echo apply_filters('out_of_stock_add_to_cart_text', __('Read More', 'woocommerce'));
                ?>
</a>

                        <?php 
            } else {
                $link = array('url' => '', 'label' => '', 'class' => '');
                $handler = apply_filters('woocommerce_add_to_cart_handler', $product->product_type, $product);
                switch ($handler) {
                    case "variable":
                        $link['url'] = apply_filters('variable_add_to_cart_url', get_permalink($product->id));
                        $link['label'] = apply_filters('variable_add_to_cart_text', __('Select options', 'woocommerce'));
                        break;
                    case "grouped":
                        $link['url'] = apply_filters('grouped_add_to_cart_url', get_permalink($product->id));
                        $link['label'] = apply_filters('grouped_add_to_cart_text', __('View options', 'venedor'));
                        break;
                    case "external":
                        $link['url'] = apply_filters('external_add_to_cart_url', get_permalink($product->id));
                        $link['label'] = apply_filters('external_add_to_cart_text', __('Read More', 'woocommerce'));
                        break;
                    default:
                        if ($product->is_purchasable()) {
                            $link['url'] = apply_filters('add_to_cart_url', esc_url($product->add_to_cart_url()));
                            $link['label'] = apply_filters('add_to_cart_text', __('Add to cart', 'woocommerce'));
                            $link['class'] = apply_filters('add_to_cart_class', 'add_to_cart_button');
                        } else {
                            $link['url'] = apply_filters('not_purchasable_url', get_permalink($product->id));
                            $link['label'] = apply_filters('not_purchasable_text', __('Read More', 'woocommerce'));
                        }
                        break;
                }
                echo apply_filters('woocommerce_loop_add_to_cart_link', sprintf('<a href="%s" rel="nofollow" data-product_id="%s" data-product_sku="%s" class="%s cart-links btn btn-lg product_type_%s">%s</a>', esc_url($link['url']), esc_attr($product->id), esc_attr($product->get_sku()), esc_attr($link['class']), esc_attr($product->product_type), esc_html($link['label'])), $product, $link);
            }
            ?>
                    </div></div>
                </div></div>

            <?php 
        }
        // end of the loop.
        ?>

            </div>

            <script type="text/javascript">
            /* <![CDATA[ */
            jQuery(function($) {
                var itemsCustom;

                $('.product-featured-slider').owlCarousel({
                    singleItem: true,
                    navigation: false,
                    pagination: false,
                    transitionStyle : "fade",
                    slideSpeed: 300
                });
                $('.product-featured-slider .product-image').addClass('effect2');
                $('.product-featured-slider .product-image').append('<div class="btn btn-arrow prev"></div><div class="btn btn-arrow next"></div>');
                $('.product-featured-slider .product-image .next').click(function() {
                    $('.product-featured-slider').data('owl-carousel').next();
                });
                $('.product-featured-slider .product-image .prev').click(function() {
                    $('.product-featured-slider').data('owl-carousel').prev();
                });
            })
            /* ]]> */
            </script>

        </div>

    <?php 
    }
    wp_reset_postdata();
}
コード例 #4
0
ファイル: single.php プロジェクト: robwri32/garland
    
                        </div>
                        <div class="post-title">
                            <a href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    the_title();
                    ?>
</a>
                        </div>
                        <p><?php 
                    echo venedor_excerpt(15, false);
                    ?>
</p>
                        <div class="entry-meta clearfix">
                            <div class="left">
                                <a class="read-more" href="<?php 
                    the_permalink();
                    ?>
" title="<?php 
                    the_title();
                    ?>
"><?php 
                    _e('Read More', 'venedor');
                    ?>
</a>
                            </div>
コード例 #5
0
                            </div>
                            <div class="col-md-7 col-sm-6">
                                <h2 class="portfolio-title"><a href="<?php 
        the_permalink();
        ?>
" title="<?php 
        the_title();
        ?>
"><?php 
        the_title();
        ?>
</a></h2>

                                <div class="entry-content">
                                    <p><?php 
        echo venedor_excerpt(45);
        ?>
</p>
                                </div>
                                <div class="entry-meta">
                                    <div class="meta-item meta-date"><div class="meta-inner"><span class="fa fa-calendar"></span> <?php 
        the_date();
        ?>
 <?php 
        the_time();
        ?>
</div></div>
                                    <div class="meta-item meta-cat"><div class="meta-inner"><span class="fa fa-folder-open"></span> <?php 
        echo get_the_term_list($post->ID, 'portfolio_cat', '', ', ', '');
        ?>
</div></div>