/** * Process and return shortcode for Pinterest Follow Button * * @since 1.0.0 * @modified 1.0.1 * * @return string */ function pw_follow_button($attr) { extract(shortcode_atts(array('username' => 'pinterest', 'label' => 'Follow me on Pinterest'), $attr)); $before_html = ''; $html = '<div class="pw-wrap pw-shortcode">' . pw_pin_follow($username, $label) . '</div>'; $after_html = ''; $before_html = apply_filters('pw_follow_button_shortcode_before', $before_html); $html = apply_filters('pw_follow_button_shortcode_html', $html); $after_html = apply_filters('pw_follow_button_shortcode_after', $after_html); return $before_html . $html . $after_html; }
/** * Return public facing code for the Pinterest Follow Button Widget * * @since 1.0.0 * @modified 1.0.1 * * @return string */ public function widget($args, $instance) { extract($args); $title = apply_filters('widget_title', empty($instance['title']) ? '' : $instance['title'], $instance, $this->id_base); // If the user saved empty values then we will send the defaults to the function $pin_username = !empty($instance['pin_username']) ? $instance['pin_username'] : '******'; $button_label = !empty($instance['button_label']) ? $instance['button_label'] : 'Follow me on Pinterest'; echo $before_widget; if (!empty($title)) { echo $before_title . $title . $after_title; } $html = '<div class="pw-wrap pw-widget pw-follow-button-widget">' . pw_pin_follow($pin_username, $button_label) . '</div>'; do_action('pw_follow_button_before'); echo apply_filters('pw_follow_button_html', $html); do_action('pw_follow_button_after'); echo $after_widget; }