Exemple #1
0
 public function content($atts, $content = null)
 {
     $title = $order = $text_size = $items = $el_class = $width = $el_position = '';
     extract(shortcode_atts(array('title' => '', 'twitter_username' => '', 'text_size' => 'normal', 'tweets_count' => '6', 'animation' => 'fade', 'autoplay' => 'yes', 'el_class' => '', 'alt_background' => 'none', 'el_position' => '', 'width' => '1/1'), $atts));
     $output = '';
     if ($autoplay == "yes") {
         $items .= '<div class="flexslider tweets-slider content-slider" data-animation="' . $animation . '" data-autoplay="yes"><ul class="slides">';
     } else {
         $items .= '<div class="flexslider tweets-slider content-slider" data-animation="' . $animation . '" data-autoplay="no"><ul class="slides">';
     }
     $items .= sf_get_tweets($twitter_username, $tweets_count);
     $items .= '</ul></div>';
     $el_class = $this->getExtraClass($el_class);
     $width = spb_translateColumnWidthToSpan($width);
     $el_class .= ' testimonial';
     if ($alt_background == "none") {
         $output .= "\n\t" . '<div class="spb_tweets_slider_widget ' . $width . $el_class . '">';
     } else {
         $output .= "\n\t" . '<div class="spb_tweets_slider_widget alt-bg ' . $alt_background . ' ' . $width . $el_class . '">';
     }
     $output .= "\n\t\t" . '<div class="spb_wrapper slider-wrap text-' . $text_size . '">';
     $output .= $title != '' ? "\n\t\t\t" . '<div class="heading-wrap"><h3 class="spb-heading spb-center-heading"><span>' . $title . '</span></h3></div>' : '';
     $output .= "\n\t\t\t" . $items;
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.spb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     global $sf_include_carousel;
     $sf_include_carousel = true;
     return $output;
 }
 public function content($atts, $content = null)
 {
     $title = $order = $items = $el_class = $width = $el_position = '';
     extract(shortcode_atts(array('title' => '', 'twitter_username' => '', 'tweets_count' => '6', 'animation' => 'fade', 'autoplay' => 'yes', 'el_class' => '', 'el_position' => '', 'width' => '1/1'), $atts));
     $output = '';
     if ($autoplay == "yes") {
         $items .= '<div class="flexslider tweets-slider content-slider" data-animation="' . $animation . '" data-autoplay="yes"><ul class="slides cS-hidden">';
     } else {
         $items .= '<div class="flexslider tweets-slider content-slider" data-animation="' . $animation . '" data-autoplay="no"><ul class="slides cS-hidden">';
     }
     $items .= sf_get_tweets($twitter_username, $tweets_count);
     $items .= '</ul></div>';
     $sidebar_config = sf_get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
     $sidebars = '';
     if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
         $sidebars = 'one-sidebar';
     } else {
         if ($sidebar_config == "both-sidebars") {
             $sidebars = 'both-sidebars';
         } else {
             $sidebars = 'no-sidebars';
         }
     }
     $el_class = $this->getExtraClass($el_class);
     $width = spb_translateColumnWidthToSpan($width);
     $el_class .= ' testimonial';
     $output .= "\n\t" . '<div class="spb_tweets_slider_widget ' . $width . $el_class . '">';
     $output .= "\n\t" . '<div class="spb-bg-color-wrap">';
     $output .= "\n\t\t" . '<div class="spb-asset-content spb_wrapper slider-wrap">';
     $output .= $title != '' ? "\n\t\t\t" . '<div class="heading-wrap"><h3 class="spb-heading spb-center-heading">' . $title . '</h3></div>' : '';
     if ($title == "") {
         $output .= "\n\t\t\t" . '<div class="tweet-icon"><i class="fa-twitter"></i></div>';
     }
     $output .= "\n\t\t\t" . $items;
     $output .= "\n\t\t" . '</div>';
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.spb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     if ($sidebars == "no-sidebars") {
         $output = $this->startRow($el_position, '', true) . $output . $this->endRow($el_position, '', true);
     } else {
         $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     }
     global $sf_include_carousel;
     $sf_include_carousel = true;
     return $output;
 }
 protected function content($atts, $content = null)
 {
     $width = $tweets_count = $pb_margin_bottom = $pb_border_bottom = $pb_border_top = $el_class = $output = $items = $el_position = '';
     extract(shortcode_atts(array('el_position' => '', 'tweets_count' => '1', 'pb_margin_bottom' => 'no', 'pb_border_bottom' => 'no', 'pb_border_top' => 'no', 'width' => '1/1', 'twitter_username' => '', 'el_class' => ''), $atts));
     if ($pb_margin_bottom == "yes") {
         $el_class .= ' pb-margin-bottom';
     }
     if ($pb_border_bottom == "yes") {
         $el_class .= ' pb-border-bottom';
     }
     if ($pb_border_top == "yes") {
         $el_class .= ' pb-border-top';
     }
     $tweet_output = sf_get_tweets($twitter_username, $tweets_count);
     $el_class = $this->getExtraClass($el_class);
     $width = spb_translateColumnWidthToSpan($width);
     $output .= "\n\t" . '<div class="spb_latest_tweets_widget ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="spb-asset-content spb_wrapper latest-tweets-wrap clearfix">';
     $output .= "\n\t\t\t" . '<div class="twitter-bird"><i class="fa-twitter"></i></div><ul class="tweet-wrap">' . $tweet_output . "</ul>";
     $output .= "\n\t\t" . '</div> ' . $this->endBlockComment('.spb_wrapper');
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     return $output;
 }
Exemple #4
0
 function sf_blog_items($atts)
 {
     extract(shortcode_atts(array('blog_type' => '', 'gutters' => '', 'columns' => '', 'fullwidth' => '', 'show_title' => '', 'show_excerpt' => '', 'show_details' => '', 'offset' => '', 'order_by' => 'date', 'order' => 'DESC', 'excerpt_length' => '', 'show_read_more' => '', 'item_count' => '', 'category' => '', 'exclude_categories' => '', 'pagination' => '', 'social_integration' => '', 'twitter_username' => '', 'instagram_id' => '', 'instagram_token' => '', 'insta_item_count' => '', 'tweet_item_count' => '', 'blog_filter' => '', 'alt_styling' => '', 'hover_style' => '', 'content_output' => '', 'post_type' => '', 'width' => ''), $atts));
     $blog_items_output = "";
     global $sf_options, $sf_sidebar_config;
     /* CATEGORY SLUG MODIFICATION
        ================================================== */
     if ($category == "All") {
         $category = "all";
     }
     if ($category == "all") {
         $category = '';
     }
     $category_slug = str_replace('_', '-', $category);
     /* BLOG QUERY SETUP
        ================================================== */
     global $post, $wp_query;
     if (get_query_var('paged')) {
         $paged = get_query_var('paged');
         $offset = $offset + $item_count * ($paged - 1);
     } elseif (get_query_var('page')) {
         $paged = get_query_var('page');
         $offset = $offset + $item_count * ($paged - 1);
     } else {
         $paged = 1;
     }
     if ($post_type == "") {
         $post_type = "post";
     }
     $blog_args = array();
     $category_array = explode(",", $category_slug);
     if (isset($category_array) && $category_array[0] != "") {
         $blog_args = array('post_type' => $post_type, 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => $item_count, 'offset' => $offset, 'order' => $order, 'orderby' => $order_by, 'tax_query' => array(array('taxonomy' => 'category', 'field' => 'slug', 'terms' => $category_array)));
     } else {
         $blog_args = array('post_type' => $post_type, 'post_status' => 'publish', 'paged' => $paged, 'posts_per_page' => $item_count, 'offset' => $offset, 'order' => $order, 'orderby' => $order_by);
     }
     $blog_items = new WP_Query($blog_args);
     /* LIST CLASS CONFIG
        ================================================== */
     $list_class = $wrap_class = '';
     if ($blog_type == "masonry") {
         $list_class .= 'masonry-items';
         if ($gutters == "no") {
             $list_class .= ' no-gutters';
         } else {
             $list_class .= ' gutters';
         }
         // Thumb Type
         if ($hover_style == "default" && function_exists('sf_get_thumb_type')) {
             $list_class .= ' ' . sf_get_thumb_type();
         } else {
             $list_class .= ' thumbnail-' . $hover_style;
         }
     } else {
         if ($blog_type == "bold") {
             $list_class .= 'bold-items';
         } else {
             if ($blog_type == "mini") {
                 $list_class .= 'mini-items';
             } else {
                 if ($blog_type == "timeline") {
                     $list_class .= 'timeline-items';
                     if ($sf_sidebar_config == "no-sidebars") {
                         $wrap_class .= apply_filters('sf_timeline_blog_nosidebars_wrap_class', 'col-sm-8 col-sm-offset-2');
                     }
                 } else {
                     $list_class .= 'standard-items row';
                 }
             }
         }
     }
     if ($alt_styling == "yes") {
         $list_class .= ' alt-styling';
     }
     if ($pagination == "infinite-scroll") {
         $list_class .= ' blog-inf-scroll';
     }
     /* BLOG ITEMS OUTPUT
        ================================================== */
     $blog_items_output .= '<div class="blog-items-wrap blog-' . $blog_type . ' ' . $wrap_class . '">';
     if ($blog_type == "timeline") {
         $blog_items_output .= '<div class="timeline"></div>';
     }
     if ($social_integration == "yes" && $pagination == "none" && ($twitter_username != "" || $instagram_id != "")) {
         $blog_items_output .= '<ul class="blog-items ' . $list_class . ' social-blog clearfix" data-blog-type="' . $blog_type . '">';
     } else {
         $blog_items_output .= '<ul class="blog-items ' . $list_class . ' clearfix" data-blog-type="' . $blog_type . '">';
     }
     while ($blog_items->have_posts()) {
         $blog_items->the_post();
         $post_format = get_post_format($post->ID);
         if ($post_format == "") {
             $post_format = 'standard';
         }
         if ($blog_type == "mini" || $blog_type == "standard" || $blog_type == "timeline") {
             $item_class = "col-sm-12";
         } else {
             if ($blog_type == "masonry" && $fullwidth == "yes") {
                 $item_class = "col-sm-3";
             } else {
                 if ($blog_type == "masonry") {
                     if ($columns == "5") {
                         $item_class = "col-sm-sf-5";
                     } else {
                         if ($columns == "4") {
                             $item_class = "col-sm-3";
                         } else {
                             if ($columns == "3") {
                                 $item_class = "col-sm-4";
                             } else {
                                 if ($columns == "2") {
                                     $item_class = "col-sm-6";
                                 } else {
                                     if ($columns == "1") {
                                         $item_class = "col-sm-12";
                                     }
                                 }
                             }
                         }
                     }
                 } else {
                     $item_class = "col-sm-12";
                 }
             }
         }
         $taxonomy_name = 'category';
         if ($post_type != "post") {
             $taxonomy_name = $post_type . '-category';
         }
         $post_terms = get_the_terms($post->ID, $taxonomy_name);
         $term_slug = " ";
         if (!empty($post_terms)) {
             foreach ($post_terms as $post_term) {
                 $term_slug = $term_slug . $post_term->slug . ' ';
             }
         }
         /* BLOG ITEM OUTPUT
            ================================================== */
         $blog_items_output .= '<li itemscope itemtype="http://schema.org/BlogPosting" class="blog-item ' . $item_class . ' ' . $term_slug . ' ' . implode(' ', get_post_class()) . '" id="' . get_the_ID() . '" data-date="' . get_the_time('U') . '">';
         $blog_items_output .= sf_get_post_item($post->ID, $blog_type, $show_title, $show_excerpt, $show_details, $excerpt_length, $content_output, $show_read_more, $fullwidth);
         $blog_items_output .= '</li>';
     }
     wp_reset_query();
     wp_reset_postdata();
     $blog_items_output .= '</ul>';
     /* SOCIAL INTEGRATION
        ================================================== */
     if ($social_integration == "yes" && $pagination == "none") {
         $tweet_count = $instagram_count = floor($item_count / 4);
         $item_count = $item_count - $tweet_count - $instagram_count;
         if ($instagram_id == "") {
             $tweet_count = $tweet_count * 2;
         } else {
             if ($twitter_username == "") {
                 $instagram_count = $instagram_count * 2;
             }
         }
         if ($insta_item_count != "") {
             $instagram_count = $insta_item_count;
         }
         if ($tweet_item_count != "") {
             $tweet_count = $tweet_item_count;
         }
         /* TWEETS
            ================================================== */
         if ($twitter_username != "") {
             if ($fullwidth == "yes") {
                 $blog_items_output .= '<ul class="blog-tweets">' . sf_get_tweets($twitter_username, $tweet_count, 'blog-fw', $item_class) . '</ul>';
             } else {
                 $blog_items_output .= '<ul class="blog-tweets">' . sf_get_tweets($twitter_username, $tweet_count, 'blog', $item_class) . '</ul>';
             }
         }
         /* INSTAGRAMS
            ================================================== */
         if ($instagram_id != "" && $instagram_token != "") {
             $blog_items_output .= '<ul class="blog-instagrams" data-title="' . __("Instagram", "swiftframework") . '" data-count="' . $instagram_count . '" data-userid="' . $instagram_id . '" data-token="' . $instagram_token . '" data-itemclass="' . $item_class . '"></ul>';
         }
     }
     /* PAGINATION OUTPUT
        ================================================== */
     if ($pagination == "infinite-scroll") {
         global $sf_include_infscroll;
         $sf_include_infscroll = true;
         $blog_items_output .= '<div class="pagination-wrap hidden">';
         $blog_items_output .= pagenavi($blog_items);
         $blog_items_output .= '</div>';
     } else {
         if ($pagination == "load-more") {
             global $sf_include_infscroll;
             $sf_include_infscroll = true;
             $blog_items_output .= '<a href="#" class="load-more-btn">' . __('Load More', 'swiftframework') . '</a>';
             $blog_items_output .= '<div class="pagination-wrap load-more hidden">';
             $blog_items_output .= pagenavi($blog_items);
             $blog_items_output .= '</div>';
         } else {
             if ($pagination == "standard") {
                 if ($blog_type == "masonry") {
                     $blog_items_output .= '<div class="pagination-wrap masonry-pagination">';
                 } else {
                     $blog_items_output .= '<div class="pagination-wrap">';
                 }
                 $blog_items_output .= pagenavi($blog_items);
                 $blog_items_output .= '</div>';
             }
         }
     }
     $blog_items_output .= '</div>';
     /* FUNCTION OUTPUT
        ================================================== */
     return $blog_items_output;
 }
 protected function content($atts, $content = null)
 {
     $title = $width = $el_class = $output = $show_blog_aux = $exclude_categories = $blog_aux = $show_read_more = $offset = $posts_order = $content_output = $items = $item_figure = $el_position = '';
     extract(shortcode_atts(array('title' => '', 'fullwidth' => 'yes', "item_count" => '5', "instagram_id" => '', "instagram_token" => '', "twitter_username" => '', "category" => '', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     $width = spb_translateColumnWidthToSpan($width);
     /* SIDEBAR CONFIG
        ================================================== */
     $sidebar_config = sf_get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
     $sidebars = '';
     if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
         $sidebars = 'one-sidebar';
     } else {
         if ($sidebar_config == "both-sidebars") {
             $sidebars = 'both-sidebars';
         } else {
             $sidebars = 'no-sidebars';
         }
     }
     $blog_items_output = "";
     global $sf_options, $sf_sidebar_config;
     /* CATEGORY SLUG MODIFICATION
        ================================================== */
     if ($category == "All") {
         $category = "all";
     }
     if ($category == "all") {
         $category = '';
     }
     $category_slug = str_replace('_', '-', $category);
     /* BLOG QUERY SETUP
        ================================================== */
     global $post, $wp_query;
     if (get_query_var('paged')) {
         $paged = get_query_var('paged');
     } elseif (get_query_var('page')) {
         $paged = get_query_var('page');
     } else {
         $paged = 1;
     }
     $tweet_count = $instagram_count = floor($item_count / 2);
     if ($tweet_count + $instagram_count < $item_count) {
         $tweet_count = $item_count - $instagram_count;
     }
     if ($twitter_username == "") {
         $tweet_count = 0;
         $instagram_count = $item_count;
     }
     if ($instagram_id == "" || $instagram_token == "") {
         $instagram_count = 0;
         $tweet_count = $item_count;
     }
     /* BLOG ITEMS OUTPUT
        ================================================== */
     $blog_items_output .= '<div class="blog-items blog-grid-items">';
     $blog_items_output .= '<ul class="grid-items row clearfix">';
     $blog_items_output .= '</ul>';
     /* TWEETS
        ================================================== */
     if ($twitter_username != "") {
         $blog_items_output .= '<ul class="blog-tweets">' . sf_get_tweets($twitter_username, $tweet_count, 'blog-grid') . '</ul>';
     }
     /* INSTAGRAMS
        ================================================== */
     if ($instagram_id != "" && $instagram_token != "") {
         $blog_items_output .= '<ul class="blog-instagrams" data-title="' . __("Instagram", 'swift-framework-plugin') . '" data-count="' . $instagram_count . '" data-userid="' . $instagram_id . '" data-token="' . $instagram_token . '" data-itemclass="col-sm-sf-5"></ul>';
     }
     $blog_items_output .= '</div>';
     /* FINAL OUTPUT
        ================================================== */
     if ($fullwidth == "yes") {
         $fullwidth = true;
     } else {
         $fullwidth = false;
     }
     $el_class = $this->getExtraClass($el_class);
     $output .= "\n\t" . '<div class="spb_blog_grid_widget blog-wrap spb_content_element ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="spb-asset-content">';
     $output .= $title != '' ? "\n\t\t\t" . $this->spb_title($title, '', $fullwidth) : '';
     $output .= "\n\t\t" . $blog_items_output;
     $output .= "\n\t\t" . '</div>';
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     if ($fullwidth) {
         $output = $this->startRow($el_position, '', true) . $output . $this->endRow($el_position, '', true);
     } else {
         $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     }
     global $sf_has_blog, $sf_include_imagesLoaded;
     $sf_include_imagesLoaded = true;
     $sf_has_blog = true;
     return $output;
 }
Exemple #6
0
 protected function content($atts, $content = null)
 {
     $title = $width = $el_class = $output = $items_output = $el_position = '';
     extract(shortcode_atts(array('title' => '', 'fullwidth' => 'yes', "item_count" => '5', "instagram" => '', "twitter_username" => '', 'el_position' => '', 'width' => '1/1', 'el_class' => ''), $atts));
     $width = spb_translateColumnWidthToSpan($width);
     /* SIDEBAR CONFIG
        ================================================== */
     $sidebar_config = sf_get_post_meta(get_the_ID(), 'sf_sidebar_config', true);
     $sidebars = '';
     if ($sidebar_config == "left-sidebar" || $sidebar_config == "right-sidebar") {
         $sidebars = 'one-sidebar';
     } else {
         if ($sidebar_config == "both-sidebars") {
             $sidebars = 'both-sidebars';
         } else {
             $sidebars = 'no-sidebars';
         }
     }
     $items_output = "";
     global $sf_options, $sf_sidebar_config;
     /* COUNT CALC
        ================================================== */
     $item_class = "col-sm-4";
     if ($fullwidth == "yes") {
         $item_class = "col-sm-sf-5";
         $item_count = $item_count * 5;
     } else {
         $item_count = $item_count * 3;
     }
     $tweet_count = $instagram_count = floor($item_count / 2);
     if ($tweet_count + $instagram_count < $item_count) {
         $tweet_count = $item_count - $instagram_count;
     }
     if ($twitter_username == "") {
         $tweet_count = 0;
         $instagram_count = $item_count;
     }
     if ($instagram != "yes") {
         $instagram_count = 0;
         $tweet_count = $item_count;
     }
     /* ITEMS OUTPUT
        ================================================== */
     $items_output .= '<div class="blog-items blog-grid-items">';
     $items_output .= '<ul class="grid-items row clearfix">';
     $items_output .= '</ul>';
     /* TWEETS
        ================================================== */
     if ($twitter_username != "") {
         $items_output .= '<ul class="blog-tweets">' . sf_get_tweets($twitter_username, $tweet_count, 'blog-grid', $item_class) . '</ul>';
     }
     /* INSTAGRAMS
        ================================================== */
     $instagram_token = get_option('sf_instagram_access_token');
     $instagram_id = get_option('sf_instagram_user_id');
     if ($instagram_id != "" && $instagram_token != "") {
         $items_output .= '<ul class="blog-instagrams" data-title="' . __("Instagram", 'swift-framework-plugin') . '" data-count="' . $instagram_count . '" data-userid="' . $instagram_id . '" data-token="' . $instagram_token . '" data-itemclass="' . $item_class . '"></ul>';
     }
     $items_output .= '</div>';
     /* FINAL OUTPUT
        ================================================== */
     if ($fullwidth == "yes") {
         $fullwidth = true;
     } else {
         $fullwidth = false;
     }
     $el_class = $this->getExtraClass($el_class);
     $output .= "\n\t" . '<div class="spb_blog_grid_widget blog-wrap spb_content_element ' . $width . $el_class . '">';
     $output .= "\n\t\t" . '<div class="spb-asset-content">';
     $output .= $title != '' ? "\n\t\t\t" . $this->spb_title($title, '', $fullwidth) : '';
     $output .= "\n\t\t" . $items_output;
     $output .= "\n\t\t" . '</div>';
     $output .= "\n\t" . '</div> ' . $this->endBlockComment($width);
     if ($fullwidth) {
         $output = $this->startRow($el_position, '', true) . $output . $this->endRow($el_position, '', true);
     } else {
         $output = $this->startRow($el_position) . $output . $this->endRow($el_position);
     }
     global $sf_has_blog, $sf_include_imagesLoaded;
     $sf_include_imagesLoaded = true;
     $sf_has_blog = true;
     return $output;
 }