Beispiel #1
0
    function wd_features_function($atts, $content)
    {
        extract(shortcode_atts(array('slug' => '', 'id' => 0, 'icon_image' => '', 'style' => 'vertical', 'icon_style' => 'icon-no-border', 'show_icon' => 1, 'show_title' => 1, 'show_excerpt' => 1, 'icon_color' => '', 'border_color' => '', 'icon_hover_color' => '', 'border_hover_color' => ''), $atts));
        $_actived = apply_filters('active_plugins', get_option('active_plugins'));
        if (!in_array("features-by-woothemes/woothemes-features.php", $_actived)) {
            return;
        }
        if (absint($id) > 0) {
            $_feature = woothemes_get_features(array('id' => $id));
        } elseif (strlen(trim($slug)) > 0) {
            $_feature = get_page_by_path($slug, OBJECT, 'feature');
            if (!is_null($_feature)) {
                $_feature = woothemes_get_features(array('id' => $_feature->ID));
            } else {
                return;
            }
        } else {
            return;
            //invalid input params.
        }
        //nothing found
        if (!is_array($_feature) && count($_feature) <= 0) {
            return;
        } else {
            global $post;
            $_feature = $_feature[0];
            $post = $_feature;
            setup_postdata($post);
        }
        static $wd_feature_number = 1;
        $unique_class = 'wd_shortcode_feature_' . $wd_feature_number;
        $wd_feature_number++;
        $custom_style = '';
        if ($icon_color != '') {
            $custom_style .= '.' . $unique_class . ' .feature_icon a span{color:' . $icon_color . '}';
        }
        if ($icon_hover_color != '') {
            $custom_style .= '.' . $unique_class . ' .feature_icon a:hover span{color:' . $icon_hover_color . '}';
        }
        if ($border_color != '' && $icon_style != 'icon-no-border') {
            $custom_style .= '.' . $unique_class . ' .feature_icon a{border-color:' . $border_color . '}';
        }
        if ($border_hover_color != '' && $icon_style != 'icon-no-border') {
            $custom_style .= '.' . $unique_class . ' .feature_icon a:hover{border-color:' . $border_hover_color . '}';
        }
        //handle features
        ob_start();
        if ($custom_style != '') {
            $custom_style = '<style type="text/css">' . $custom_style . '</style>';
            echo $custom_style;
        }
        ?>
			<div class="wd_shortcode_feature <?php 
        echo esc_attr($unique_class);
        ?>
 <?php 
        echo esc_attr($style);
        ?>
 <?php 
        echo esc_attr($icon_style);
        ?>
">
				<div id="post-<?php 
        the_ID();
        ?>
" <?php 
        post_class('shortcode');
        ?>
>
					
					<div class="feature_content_wrapper">	
					<?php 
        if ($show_icon) {
            ?>
						<div class="feature_icon">
							<a href="<?php 
            echo esc_url($_feature->url);
            ?>
">
								<span class="<?php 
            echo $icon_image;
            ?>
" ></span>
							</a>
						</div>
					<?php 
        }
        ?>
					
						<div class="feature_title_excerpt">
							<?php 
        if ($show_title) {
            ?>
								<h3 class="feature_title heading_title bold-upper-big ">
									<a href="<?php 
            echo esc_url($_feature->url);
            ?>
"><?php 
            the_title();
            ?>
</a>
								</h3>
							<?php 
        }
        ?>
							
							<?php 
        if ($show_excerpt) {
            ?>
								<div class="feature_excerpt text-strong">
									<?php 
            the_excerpt();
            ?>
								</div>
							<?php 
        }
        ?>
						</div>
					</div>
				
				</div>
			</div>
			<?php 
        $output = ob_get_contents();
        ob_end_clean();
        wp_reset_postdata();
        return $output;
    }
 /**
  * Display or return HTML-formatted testimonials.
  * @param  string/array $args  Arguments.
  * @since  1.0.0
  * @return string
  */
 function woothemes_features($args = '')
 {
     global $post;
     $defaults = array('limit' => 5, 'orderby' => 'menu_order', 'order' => 'DESC', 'id' => 0, 'echo' => true, 'size' => 50, 'per_row' => 3, 'link_title' => true, 'title' => '', 'before' => '<div class="widget widget_woothemes_features">', 'after' => '</div><!--/.widget widget_woothemes_features-->', 'before_title' => '<h2>', 'after_title' => '</h2>');
     $args = wp_parse_args($args, $defaults);
     // Allow child themes/plugins to filter here.
     $args = apply_filters('woothemes_features_args', $args);
     $html = '';
     do_action('woothemes_features_before', $args);
     // The Query.
     $query = woothemes_get_features($args);
     // The Display.
     if (!is_wp_error($query) && is_array($query) && count($query) > 0) {
         $html .= $args['before'] . "\n";
         if ('' != $args['title']) {
             $html .= $args['before_title'] . esc_html($args['title']) . $args['after_title'] . "\n";
         }
         $html .= '<div class="features">' . "\n";
         // Begin templating logic.
         $tpl = '<div class="%%CLASS%%">%%IMAGE%%<h3 class="feature-title">%%TITLE%%</h3><div class="feature-content">%%CONTENT%%</div></div>';
         $tpl = apply_filters('woothemes_features_item_template', $tpl, $args);
         $i = 0;
         foreach ($query as $post) {
             $template = $tpl;
             $i++;
             setup_postdata($post);
             $class = 'feature';
             if (0 == $i % $args['per_row']) {
                 $class .= ' last';
             } elseif (0 == ($i - 1) % $args['per_row']) {
                 $class .= ' first';
             }
             $title = get_the_title();
             if (true == $args['link_title']) {
                 $post->image = '<a href="' . esc_url($post->url) . '" title="' . esc_attr($title) . '">' . $post->image . '</a>';
                 $title = '<a href="' . esc_url($post->url) . '" title="' . esc_attr($title) . '">' . $title . '</a>';
             }
             // Optionally display the image, if it is available.
             if (isset($post->image) && '' != $post->image) {
                 $template = str_replace('%%IMAGE%%', $post->image, $template);
             } else {
                 $template = str_replace('%%IMAGE%%', '', $template);
             }
             $template = str_replace('%%CLASS%%', $class, $template);
             $template = str_replace('%%TITLE%%', $title, $template);
             if ('' != $post->post_excerpt) {
                 $template = str_replace('%%CONTENT%%', get_the_excerpt(), $template);
             } else {
                 $template = str_replace('%%CONTENT%%', get_the_content(), $template);
             }
             $template = apply_filters('woothemes_features_template', $template, $post);
             $html .= $template;
             if (0 == $i % $args['per_row']) {
                 $html .= '<div class="fix"></div>' . "\n";
             }
         }
         $html .= '</div><!--/.features-->' . "\n";
         $html .= $args['after'] . "\n";
         wp_reset_postdata();
     }
     // Allow child themes/plugins to filter here.
     $html = apply_filters('woothemes_features_html', $html, $query, $args);
     if ($args['echo'] != true) {
         return $html;
     }
     // Should only run is "echo" is set to true.
     echo $html;
     do_action('woothemes_features_after', $args);
     // Only if "echo" is set to true.
 }
 public static function features($atts)
 {
     $atts = shortcode_atts(array("title" => '', "id" => 0, "per_row" => 3, "limit" => 5, "size" => 150, "color" => '', "t_color" => '', "l_color" => '', "style" => '', "w_limit" => -1, "use_boxed" => '0', "learn_more" => '0'), $atts);
     if (strlen(trim($atts['id'])) == 0) {
         return '';
     }
     $nth_features = woothemes_get_features(array('id' => $atts['id'], 'limit' => $atts['limit'], 'size' => $atts['size']));
     ob_start();
     if (!empty($nth_features) && count($nth_features) > 0) {
         $atts['nth_features'] = $nth_features;
         parent::get_template("shortcode-features.tpl.php", $atts);
     }
     wp_reset_postdata();
     return '<div class="widget widget_woothemes_features">' . ob_get_clean() . '</div>';
 }
Beispiel #4
0
<?php

// **********************************************************************//
// ! Register New Element: WD Feature
// **********************************************************************//
// ! File Security Check
if (!defined('ABSPATH')) {
    exit;
}
// **********************************************************************//
// ! Register New Element: WD Feature
// **********************************************************************//
$wd_is_feature = true;
$_actived = apply_filters('active_plugins', get_option('active_plugins'));
if (!in_array("features-by-woothemes/woothemes-features.php", $_actived)) {
    $wd_is_feature = false;
}
if ($wd_is_feature) {
    $features = woothemes_get_features(array('limit' => -1));
    $list_features = array();
    if (is_array($features)) {
        foreach ($features as $feature) {
            $list_features[$feature->post_title] = $feature->ID;
        }
    }
    $feature_params = array("name" => __("Feature", "wpdance"), "base" => "wd_feature", "icon" => "icon-wpb-wpdance", "category" => __("WPDance Elements", "wpdance"), "params" => array(array("type" => "dropdown", "class" => "", "heading" => __("Feature", "wpdance"), "admin_label" => true, "param_name" => "id", "value" => $list_features, "description" => ""), array("type" => "textfield", "class" => "", "heading" => __("Icon Feature", "wpdance"), "admin_label" => true, "param_name" => "icon_image", "value" => "", "description" => __("Ex:fa fa-home (use font Awesome icon)", "wpdance")), array("type" => "dropdown", "class" => "", "heading" => __("Show Icon", "wpdance"), "admin_label" => true, "param_name" => "show_icon", "value" => array('Yes' => 1, 'No' => 0), "description" => ""), array("type" => "dropdown", "class" => "", "heading" => __("Show Title", "wpdance"), "admin_label" => true, "param_name" => "title", "value" => array('Yes' => 1, 'No' => 0), "description" => ""), array("type" => "dropdown", "class" => "", "heading" => __("Show Excerpt", "wpdance"), "admin_label" => true, "param_name" => "excerpt", "value" => array('Yes' => 1, 'No' => 0), "description" => "")));
    vc_map($feature_params);
}
    function features_function($atts, $content)
    {
        extract(shortcode_atts(array('slug' => '', 'id' => 0, 'title' => 'yes', 'thumbnail' => 'yes', 'excerpt' => 'yes', 'content' => 'yes'), $atts));
        $_actived = apply_filters('active_plugins', get_option('active_plugins'));
        if (!in_array("features-by-woothemes/woothemes-features.php", $_actived)) {
            return;
        }
        if (absint($id) > 0) {
            $_feature = woothemes_get_features(array('id' => $id));
        } elseif (strlen(trim($slug)) > 0) {
            $_feature = get_page_by_path($slug, OBJECT, 'feature');
            if (!is_null($_feature)) {
                $_feature = woothemes_get_features(array('id' => $_feature->ID));
            } else {
                return;
            }
        } else {
            return;
            //invalid input params.
        }
        //nothing found
        if (!is_array($_feature) && count($_feature) <= 0) {
            return;
        } else {
            global $post;
            $_feature = $_feature[0];
            $post = $_feature;
            setup_postdata($post);
        }
        //handle features
        ob_start();
        ?>

				<div id="post-<?php 
        the_ID();
        ?>
" <?php 
        post_class('shortcode');
        ?>
>
					
					<?php 
        if (strcmp(trim($title), 'yes') == 0) {
            ?>
						<h3 class="feature_title heading_title">
							<a href="<?php 
            echo esc_url($_feature->url);
            ?>
"><?php 
            the_title();
            ?>
</a>
						</h3>
					<?php 
        }
        ?>
					<div class="feature_content_wrapper">	
					<?php 
        if (strcmp(trim($thumbnail), 'yes') == 0) {
            ?>
						<div class="feature_thumbnail">
							<?php 
            if (has_post_thumbnail()) {
                the_post_thumbnail('woo_shortcode', array('alt' => esc_attr(get_the_title()), 'title' => esc_attr(get_the_title())));
            }
            ?>
						</div>
					<?php 
        }
        ?>
					
					<?php 
        if (strcmp(trim($excerpt), 'yes') == 0) {
            ?>
						<div class="feature_excerpt">
							<?php 
            the_excerpt();
            ?>
						</div>
					<?php 
        }
        ?>
					
					<?php 
        if (strcmp(trim($content), 'yes') == 0) {
            ?>
						<div class="feature_content ">
							<?php 
            the_content();
            ?>
						</div>
					<?php 
        }
        ?>
					</div>
				
				</div>

			<?php 
        $output = ob_get_contents();
        ob_end_clean();
        rewind_posts();
        wp_reset_query();
        return $output;
    }
Beispiel #6
0
    function wd_features_slider_function($atts, $content)
    {
        extract(shortcode_atts(array('slug' => '', 'id' => 0, 'columns' => 3, 'show_title' => 1, 'show_thumbnail' => 1, 'show_excerpt' => 1, 'limit' => 4, 'show_nav' => 1, 'show_icon_nav' => 0, 'autoplay' => 1), $atts));
        $_actived = apply_filters('active_plugins', get_option('active_plugins'));
        if (!in_array("features-by-woothemes/woothemes-features.php", $_actived)) {
            return;
        }
        if (absint($id) > 0) {
            $_feature = woothemes_get_features(array('id' => $id));
        } elseif (strlen(trim($slug)) > 0) {
            $_feature = get_page_by_path($slug, OBJECT, 'feature');
            if (!is_null($_feature)) {
                $_feature = woothemes_get_features(array('id' => $_feature->ID, 'limit' => 1, 'size' => 100));
            } else {
                return;
            }
        } else {
            // Load multi testimonial
            $_feature = woothemes_get_features(array('limit' => $limit, 'size' => 100));
            //invalid input params.
        }
        //nothing found
        if (!is_array($_feature) && count($_feature) <= 0) {
            return;
        } else {
            global $post;
        }
        //handle features
        ob_start();
        $random_id = 'wd_feature_wrapper_' . rand(0, 1000);
        ?>
			<div class="wd_shortcode_feature_slider loading ">
				<div id="<?php 
        echo $random_id;
        ?>
" <?php 
        post_class('shortcode');
        ?>
 >
				<?php 
        foreach ($_feature as $feature) {
            $post = $feature;
            setup_postdata($post);
            ?>
					<div class="item">
						<div class="feature_content_wrapper">	
						<?php 
            if ($show_thumbnail) {
                ?>
							<div class="feature_thumbnail">
								<a href="<?php 
                echo esc_url($feature->url);
                ?>
">
								<?php 
                if (has_post_thumbnail()) {
                    the_post_thumbnail('woo_feature', array('alt' => esc_attr(get_the_title()), 'title' => esc_attr(get_the_title())));
                }
                ?>
								<div class="wd-effect"></div>
								</a>
							</div>
						<?php 
            }
            ?>
						<?php 
            if ($show_title) {
                ?>
							<h3 class="feature_title heading_title bold-upper-big">
								<a href="<?php 
                echo esc_url($feature->url);
                ?>
"><?php 
                the_title();
                ?>
</a>
							</h3>
						<?php 
            }
            ?>
						<?php 
            if ($show_excerpt) {
                ?>
							<div class="feature_excerpt text-strong">
								<?php 
                the_excerpt();
                ?>
							</div>
						<?php 
            }
            ?>
						</div>
					</div>
				<?php 
        }
        ?>
				</div>
			</div>	
			<script type='text/javascript'>
				jQuery(document).ready(function(){
					"use strict";
					var temp_visible = <?php 
        echo esc_js($columns);
        ?>
;
					
					var row = 1;

					var item_width = 180;
					
					var show_nav = <?php 
        if ($show_nav) {
            ?>
 true <?php 
        } else {
            ?>
 false <?php 
        }
        ?>
;

					var show_icon_nav = <?php 
        if ($show_icon_nav) {
            ?>
 true <?php 
        } else {
            ?>
 false <?php 
        }
        ?>
;
					
					var object_selector = "#<?php 
        echo esc_js($random_id);
        ?>
";
						
					var autoplay = <?php 
        if ($autoplay) {
            ?>
 true <?php 
        } else {
            ?>
 false <?php 
        }
        ?>
;
						
					var slider_data = {
							nav : show_nav
							,dots : show_icon_nav
							,autoplay : autoplay
							,responsive: {
								0 : {
									items: 1
								}
								,400 : {
									items: 2
								}
								,800 : {
									items: 3
								}
								,1160 : {
									items: <?php 
        echo esc_js($columns);
        ?>
								}
							}
					}
						
					generate_horizontal_slide(slider_data, row, object_selector);
				});
			</script>
			<?php 
        $output = ob_get_contents();
        ob_end_clean();
        wp_reset_postdata();
        return $output;
    }