0, 'layout'=>'standard', // standard or button_count 'showfaces'=>'true', // true or false 'width'=>'450', 'height'=>'65', 'send' => 'false', // true or false 'action'=>'like', // like or recommend 'colorscheme'=>'light', // light or dark 'font' => 'lucida+grande', // arial, lucida+grande, seqoe+ui, tahoma, trebuchet+ms, or verdana ); function get_sfc_like_button($args='') { global $sfc_like_defaults; $options = get_option('sfc_options'); if (!empty($options['like_layout'])) $sfc_like_defaults['layout']=$options['like_layout']; if (!empty($options['like_action'])) $sfc_like_defaults['action']=$options['like_action']; if (!empty($options['like_send'])) $sfc_like_defaults['send']=$options['like_send']; $args = wp_parse_args($args, $sfc_like_defaults); extract($args); if (empty($url)) $url = urlencode(get_permalink($id)); return ""; } function sfc_like_button($args='') { echo get_sfc_like_button($args); } function sfc_like_shortcode($atts) { global $sfc_like_defaults; $options = get_option('sfc_options'); if (!empty($options['like_layout'])) $sfc_like_defaults['layout']=$options['like_layout']; if (!empty($options['like_action'])) $sfc_like_defaults['action']=$options['like_action']; if (!empty($options['like_send'])) $sfc_like_defaults['send']=$options['like_send']; $args = shortcode_atts($sfc_like_defaults, $atts); return get_sfc_like_button($args); } add_shortcode('fb-like', 'sfc_like_shortcode'); function sfc_like_button_automatic($content) { global $post; $post_types = apply_filters('sfc_like_post_types', get_post_types( array('public' => true) ) ); if ( !in_array($post->post_type, $post_types) ) return $content; // exclude bbPress post types if ( function_exists('bbp_is_custom_post_type') && bbp_is_custom_post_type() ) return $content; $options = get_option('sfc_options'); $args = array( 'layout'=>$options['like_layout'], 'action'=>$options['like_action'], 'send'=>$options['like_send'], ); $button = get_sfc_like_button($args); switch ($options['like_position']) { case "before": $content = $button . $content; break; case "after": $content = $content . $button; break; case "both": $content = $button . $content . $button; break; case "manual": default: break; } return $content; } add_filter('the_content', 'sfc_like_button_automatic', 30); // add the admin sections to the sfc page add_action('admin_init', 'sfc_like_admin_init'); function sfc_like_admin_init() { add_settings_section('sfc_like', __('Like Button Settings', 'sfc'), 'sfc_like_section_callback', 'sfc'); add_settings_field('sfc_like_position', __('Like Button Position', 'sfc'), 'sfc_like_position', 'sfc', 'sfc_like'); add_settings_field('sfc_like_layout', __('Like Button Layout', 'sfc'), 'sfc_like_layout', 'sfc', 'sfc_like'); add_settings_field('sfc_like_action', __('Like Button Action', 'sfc'), 'sfc_like_action', 'sfc', 'sfc_like'); add_settings_field('sfc_like_send', __('Send Button', 'sfc'), 'sfc_like_send', 'sfc', 'sfc_like'); } function sfc_like_section_callback() { echo '

'.__('Choose where you want the like button added to your content.', 'sfc').'

'; } function sfc_like_position() { $options = get_option('sfc_options'); if (!isset($options['like_position'])) $options['like_position'] = 'manual'; ?> 'widget_sfc-like', 'description' => __('Facebook Like Button', 'sfc')); $this->WP_Widget('sfc-like', __('Facebook Like Button (SFC)', 'sfc'), $widget_ops); } function widget($args, $instance) { extract( $args ); $title = apply_filters('widget_title', $instance['title']); $url = $instance['url']; $width = intval($instance['width']); ?> $url, 'layout'=>'standard', // standard or button_count 'showfaces'=>'false', // true or false 'width'=>$width, ) ); ?>

(PROTIP: Use the URL of your Facebook Page or App to make a like button for that Page)