function et_twitter_slider($atts) { extract(shortcode_atts(array('title' => '', 'user' => '', 'consumer_key' => '', 'consumer_secret' => '', 'user_token' => '', 'user_secret' => '', 'limit' => 10, 'class' => 10), $atts)); if (empty($consumer_key) || empty($consumer_secret) || empty($user_token) || empty($user_secret) || empty($user)) { return __('Not enough information', ETHEME_DOMAIN); } $tweets_array = et_get_tweets($consumer_key, $consumer_secret, $user_token, $user_secret, $user, $limit); $output = ''; $output .= '<div class="et-twitter-slider ' . $class . '">'; if ($title != '') { $output .= '<h2 class="twitter-slider-title"><span>' . $title . '</span></h2>'; } $output .= '<ul class="et-tweets">'; foreach ($tweets_array as $tweet) { $output .= '<li class="et-tweet">'; $output .= etheme_tweet_linkify($tweet['text']); $output .= '<div class="twitter-info">'; $output .= '<a href="' . $tweet['user']['url'] . '" class="active" target="_blank">@' . $tweet['user']['screen_name'] . '</a> ' . date("l M j \\- g:ia", strtotime($tweet['created_at'])); $output .= '</div>'; $output .= '</li>'; } $output .= '</ul>'; $output .= '</div>'; $items = '[[0, 1], [479,1], [619,1], [768,1], [1200, 1], [1600, 1]]'; $output .= '<script type="text/javascript">'; $output .= ' jQuery(".et-tweets").owlCarousel({'; $output .= ' items:1, '; $output .= ' navigation: true,'; $output .= ' navigationText:false,'; $output .= ' rewindNav: false,'; $output .= ' itemsCustom: ' . $items . ''; $output .= ' });'; $output .= ' </script>'; return $output; }
function et_twitter_slider($atts) { extract(shortcode_atts(array('title' => '', 'user' => '8theme', 'consumer_key' => '', 'consumer_secret' => '', 'user_token' => '', 'user_secret' => '', 'limit' => 10, 'class' => 10), $atts)); if (empty($consumer_key) || empty($consumer_secret) || empty($user_token) || empty($user_secret)) { return __('Not enough information', ETHEME_DOMAIN); } $tweets_array = et_get_tweets($consumer_key, $consumer_secret, $user_token, $user_secret, $user, $limit); $output = ''; $box_id = rand(1000, 9999); $output .= '<div class="et-twitter-slider ' . $class . '">'; if ($title != '') { $output .= '<h2 class="twitter-slider-title"><span>' . $title . '</span></h2>'; } $output .= '<ul class="et-tweets slider-' . $box_id . '">'; if (!empty($tweets_array['errors']) && count($tweets_array['errors']) > 0) { foreach ($tweets_array['errors'] as $error) { $output .= '<li class="et-tweet error">'; $output .= $error['message']; $output .= '</li>'; } } else { foreach ($tweets_array as $tweet) { $output .= '<li class="et-tweet">'; $output .= $tweet['text']; $output .= '</li>'; } } $output .= '</ul>'; $output .= '</div>'; $items = '[[0, 1], [479,1], [619,1], [768,1], [1200, 1], [1600, 1]]'; $output .= '<script type="text/javascript">'; $output .= ' jQuery(".slider-' . $box_id . '").owlCarousel({'; $output .= ' items:1, '; $output .= ' navigation: true,'; $output .= ' navigationText:false,'; $output .= ' rewindNav: false,'; $output .= ' itemsCustom: ' . $items . ''; $output .= ' });'; $output .= ' </script>'; $output = etheme_tweet_linkify($output); return $output; }