?> <?php if ($opt['header_enabled']) { ?> <section id="series-header" class="span12"> <h1 class="entry-title"><?php the_title(); ?> </h1> <?php if ($opt['show_series_byline']) { echo '<h5 class="byline">' . largo_byline(false) . '</h5>'; } if ($opt['show_sharebar']) { largo_post_social_links(); } ?> <div class="description"> <?php echo apply_filters('the_content', $post->post_excerpt); ?> </div> <?php if ('standard' == $opt['header_style']) { //need to set a size, make this responsive, etc ?> <div class="full series-banner full-image"><?php the_post_thumbnail('full'); ?> </div>
function test_largo_post_social_links() { // Create a post, go to it. $id = $this->factory->post->create(); $this->go_to('/?p=' . $id); // Test the output of this when no options are set of_set_option('article_utilities', array('facebook' => false, 'twitter' => false, 'print' => false, 'email' => false)); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/post-social/', $ret, "The .post-social class was not in the output"); unset($ret); // Test that this outputs the expected data for each of the button types // Twitter of_set_option('article_utilities', array('twitter' => '1', 'facebook' => false, 'print' => false, 'email' => false)); of_set_option('twitter_link', 'foo'); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/class="twitter"/', $ret, "The 'twitter' class did not appear in the output"); // @TODO: insert a test for the get_the_author_meta test here $this->assertRegExp('/' . __('Tweet', 'largo') . '/', $ret, "The translation of 'Tweet' was not in the Twitter output"); unset($ret); of_reset_options(); // Facebook of_set_option('article_utilities', array('facebook' => '1', 'twitter' => false, 'print' => false, 'email' => false)); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/' . preg_quote(esc_attr(of_get_option('fb_verb')), '/') . '/i', $ret, "The Facebook Verb was not in the Facebook output"); $this->assertRegExp('/' . preg_quote(get_permalink(), '/') . '/', $ret, "The permalink was not in the Facebook output"); unset($ret); of_reset_options(); // Print of_set_option('article_utilities', array('print' => '1', 'twitter' => '1', 'facebook' => false, 'email' => false)); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/print/', $ret, "The Print output did not include a print class"); unset($ret); of_reset_options(); // Email of_set_option('article_utilities', array('email' => '1', 'twitter' => false, 'facebook' => false, 'print' => false)); ob_start(); largo_post_social_links(); $ret = ob_get_clean(); $this->assertRegExp('/email/', $ret, "The Email output did not include an email class"); unset($ret); of_reset_options(); }
/** * How to display the widget on the screen. */ function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); echo $before_widget; /* Display the widget title if one was input */ if ($title) { echo $before_title . $title . $after_title; } $feed = get_feed_link(); if (is_single() && isset($id) && $id == 'article-bottom') { // display the post social bar largo_post_social_links(); } else { // display the usual buttons and whatnot if (of_get_option('rss_link')) { $feed = esc_url(of_get_option('rss_link')); } printf(__('<a class="subscribe" href="%1$s"><i class="icon-rss"></i>Subscribe via RSS</a>', 'largo'), $feed); if (of_get_option('twitter_link')) { ?> <a href="<?php echo esc_url(of_get_option('twitter_link')); ?> " class="twitter-follow-button" data-width="100%" data-align="left" data-size="large"><?php printf(__('Follow @%1$s', 'largo'), largo_twitter_url_to_username(of_get_option('twitter_link'))); ?> </a> <?php } if (of_get_option('facebook_link')) { ?> <div class="fb-like" data-href="<?php echo esc_url(of_get_option('facebook_link')); ?> " data-send="false" data-show-faces="false"></div> <?php } if (of_get_option('linkedin_link')) { ?> <a class="subscribe" href="<?php echo esc_url(of_get_option('linkedin_link')); ?> "><i class="icon-linkedin"></i>Find Us on LinkedIn</a> <?php } if (of_get_option('gplus_link')) { ?> <div class="g-follow" data-annotation="bubble" data-height="24" data-href="<?php echo esc_url(of_get_option('gplus_link')); ?> " data-rel="publisher"></div> <?php } if (of_get_option('flickr_link')) { ?> <div class="flickr-follow"><a href="<?php echo esc_url(of_get_option('flickr_link')); ?> " title="See our photos on Flickr!"><img src="https://s.yimg.com/pw/images/goodies/white-flickr.png" width="56" height="26" alt=""></a></div> <?php } if (of_get_option('youtube_link')) { $path = parse_url(of_get_option('youtube_link'), PHP_URL_PATH); $pathFragments = explode('/', $path); $yt_user = end($pathFragments); ?> <div class="g-ytsubscribe" data-channel="<?php echo esc_attr($yt_user); ?> " data-layout="default" data-count="default"></div> <?php } //the below is for G+ and YouTube subscribe buttons ?> <script type="text/javascript"> (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/platform.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script> <?php } echo $after_widget; }
function largo_floating_social_buttons() { $template = get_post_template(null); if (is_null($template)) { $template = of_get_option('single_template'); } $is_single_column = (bool) strstr($template, 'single-one-column') || $template == 'normal' || is_null($template); if (is_single() && of_get_option('single_floating_social_icons', '1') == '1' && $is_single_column) { echo '<script type="text/template" id="tmpl-floating-social-buttons">'; largo_post_social_links(); echo '</script>'; } }
function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', $instance['title'], $instance, $this->id_base); echo $before_widget; /* Display the widget title if one was input */ if ($title) { echo $before_title . $title . $after_title; } $feed = get_feed_link(); if (is_single() && isset($id) && $id == 'article-bottom') { // display the post social bar largo_post_social_links(); } else { // display the usual buttons and whatnot if (of_get_option('rss_link')) { $feed = esc_url(of_get_option('rss_link')); } printf(__('<a class="rss subscribe btn social-btn" href="%1$s"><i class="icon-rss"></i>Subscribe via RSS</a>', 'largo'), $feed); if (of_get_option('twitter_link')) { ?> <a href="<?php echo esc_url(of_get_option('twitter_link')); ?> " class="twitter subscribe btn social-btn"><i class="icon-twitter"></i><?php printf(__('Follow @%1$s', 'largo'), largo_twitter_url_to_username(of_get_option('twitter_link'))); ?> </a> <?php } if (of_get_option('facebook_link')) { ?> <a href="<?php echo esc_url(of_get_option('facebook_link')); ?> " class="facebook subscribe btn social-btn"><i class="icon-facebook"></i> <?php _e('Like on Facebook', 'largo'); ?> </a> <?php } if (of_get_option('linkedin_link')) { ?> <a class="linkedin subscribe btn social-btn" href="<?php echo esc_url(of_get_option('linkedin_link')); ?> "><i class="icon-linkedin"></i><?php _e('Find on LinkedIn', 'largo'); ?> </a> <?php } if (of_get_option('gplus_link')) { ?> <a class="gplus subscribe btn social-btn" href="<?php echo esc_url(of_get_option('gplus_link')); ?> "><i class="icon-gplus"></i><?php _e('Follow on G+', 'largo'); ?> </a> <?php } if (of_get_option('flickr_link')) { ?> <a class="flickr subscribe btn social-btn" href="<?php echo esc_url(of_get_option('flickr_link')); ?> "><i class="icon-flickr"></i><?php _e('Follow on Flickr', 'largo'); ?> </a> <?php } if (of_get_option('youtube_link')) { ?> <a class="youtube subscribe btn social-btn" href="<?php echo esc_url(of_get_option('youtube_link')); ?> "><i class="icon-youtube"></i><?php _e('Follow on YouTube', 'largo'); ?> </a> <?php } //the below is for G+ and YouTube subscribe buttons ?> <script type="text/javascript"> (function() { var po = document.createElement('script'); po.type = 'text/javascript'; po.async = true; po.src = 'https://apis.google.com/js/platform.js'; var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(po, s); })(); </script> <?php } echo $after_widget; }