function widget($args, $instance) { extract($args); echo $before_widget; $widget_embed = '<a class="twitter-timeline" height="500" href="https://twitter.com/'; if ($instance['widget_type'] == 'search') { $widget_embed .= 'search?q=' . $instance['twitter_search'] . '" data-widget-id="' . $instance['widget_ID'] . '"data-theme="' . $instance['widget_theme'] . '">Tweets about "' . $instance['twitter_search'] . '"</a>'; } else { $widget_embed .= $instance['twitter_username']; if ($instance['widget_type'] == 'timeline') { $widget_embed .= '" data-widget-id="' . $instance['widget_ID'] . '"data-theme="' . $instance['widget_theme'] . '">Tweets by @' . $instance['twitter_username'] . '</a>'; } elseif ($instance['widget_type'] == 'favorites') { $widget_embed .= '/favorites" data-widget-id="' . $instance['widget_ID'] . '"data-theme="' . $instance['widget_theme'] . '">Favorite Tweets by ' . $instance['twitter_username'] . '</a>'; } elseif ($instance['widget_type'] == 'list') { $widget_embed .= '/' . $instance['twitter_list_slug'] . '" data-widget-id="' . $instance['widget_ID'] . '"data-theme="' . $instance['widget_theme'] . '">Tweets from ' . $instance['twitter_username'] . '/' . $instance['twitter_list_slug'] . '</a>'; } } echo $widget_embed; echo $after_widget; self::$rendered = true; }
function largo_footer_js() { ?> <?php // Are the widgets that contain facebook social buttons loaded (or are we on single/author?) if (largo_facebook_widget::is_rendered() || largo_follow_widget::is_rendered() || is_single() || is_author()) { ?> <!--Facebook--> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/<?php echo get_locale(); ?> /all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <?php } ?> <?php // Are the widgets that contain twitter social buttons loaded (or are we on single/author?) if (largo_twitter_widget::is_rendered() || largo_follow_widget::is_rendered() || is_single() || is_author()) { ?> <!--Twitter--> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> <?php } ?> <?php }
function largo_footer_js() { if (largo_facebook_widget::is_rendered() || largo_follow_widget::is_rendered()) { ?> <!--Facebook--> <div id="fb-root"></div> <script>(function(d, s, id) { var js, fjs = d.getElementsByTagName(s)[0]; if (d.getElementById(id)) return; js = d.createElement(s); js.id = id; js.src = "//connect.facebook.net/<?php echo get_locale(); ?> /all.js#xfbml=1"; fjs.parentNode.insertBefore(js, fjs); }(document, 'script', 'facebook-jssdk'));</script> <?php } /* * Load Facebook Tracking Pixel if defined in Theme Options * * Function loads Facebook's JavaScript (circa September 2015) for * conversion tracking and send the default event. * * @link https://developers.facebook.com/docs/ads-for-websites/drive-conversions * @since 0.5.4 */ $fb_pixel_id = of_get_option('fb_tracking_pixel'); if (!empty($fb_pixel_id)) { ?> <script>(function() { var _fbq = window._fbq || (window._fbq = []); if (!_fbq.loaded) { var fbds = document.createElement('script'); fbds.async = true; fbds.src = '//connect.facebook.net/<?php echo get_locale(); ?> /fbds.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(fbds, s); _fbq.loaded = true; } _fbq.push(['addPixelId', '<?php echo $fb_pixel_id; ?> ']); })(); window._fbq = window._fbq || []; window._fbq.push(['track', 'PixelInitialized', {}]); </script> <!-- Fallback for environments not friendly to script --> <noscript> <img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=<?php echo $fb_pixel_id; ?> &ev=PixelInitialized" /> </noscript> <?php /* END tracking pixel code */ } if (largo_twitter_widget::is_rendered() || largo_follow_widget::is_rendered()) { ?> <!--Twitter--> <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+"://platform.twitter.com/widgets.js";fjs.parentNode.insertBefore(js,fjs);}}(document,"script","twitter-wjs");</script> <?php } /* * Load Facebook Tracking Pixel if defined in Theme Options * * Function loads Facebook's JavaScript (circa September 2015) for * conversion tracking and send the default event. * * @link https://developers.facebook.com/docs/ads-for-websites/drive-conversions * @since 0.5.4 */ $fb_pixel_id = of_get_option('fb_tracking_pixel'); if (!empty($fb_pixel_id)) { ?> <script> (function() { var _fbq = window._fbq || (window._fbq = []); if (!_fbq.loaded) { var fbds = document.createElement('script'); fbds.async = true; fbds.src = '//connect.facebook.net/<?php echo get_locale(); ?> /fbds.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(fbds, s); _fbq.loaded = true; } _fbq.push(['addPixelId', '<?php echo $fb_pixel_id; ?> ']); })(); window._fbq = window._fbq || []; window._fbq.push(['track', 'PixelInitialized', {}]); </script> <!-- Fallback for environments not friendly to script --> <noscript> <img height="1" width="1" alt="" style="display:none" src="https://www.facebook.com/tr?id=<?php echo $fb_pixel_id; ?> &ev=PixelInitialized" /> </noscript> <?php /* END tracking pixel code */ } }