Edit settings. Version: 1.2 Author: April Hodge Silver Author URI: http://springthistle.com */ function ahsfl_options() { add_submenu_page('themes.php', 'Facebook Like', 'Facebook Like', 8, basename(__FILE__), 'ahsfl_options_page'); } /** * Build up all the params for the button */ function ahsfl_build_options() { // get the post varibale (should be in the loop) global $post; // get the permalink if (get_post_status($post->ID) == 'publish') { $url = get_permalink(); } $button = '?href=' . urlencode($url); // which style if (get_option('ahsfl_version') == 'button_count') { $button .= '&layout=button_count'; } else { $button .= '&layout=standard'; } // show faces? if (get_option('ahsfl_faces') == 'false') { $button .= '&show_faces=false'; } else { $button .= '&show_faces=true'; } // which verb if (get_option('ahsfl_verb') == 'recommend') { $button .= '&action=recommend'; } else { $button .= '&action=like'; } // which colors if (get_option('ahsfl_colorscheme') == 'dark') { $button .= '&colorscheme=dark'; } else if (get_option('ahsfl_colorscheme') == 'evil'){ $button .= '&colorscheme=evil'; } else { $button .= '&colorscheme=light'; } // which size $button .= '&width='.get_option('ahsfl_width'); // return all the params return $button; } /** * Generate the iFrame render of the button */ function ahsfl_generate_button() { // build up the outer style $button = '
'; $button .= '
'; // return the iframe code return $button; } /** * Gets run when the content is loaded in the loop */ function ahsfl_update($content) { global $post; // add the manual option, code added by kovshenin if (get_option('ahsfl_where') == 'manual') { return $content; } // is it a page if (get_option('ahsfl_display_page') == null && is_page()) { return $content; } // are we on the front page if (get_option('ahsfl_display_front') == null && is_home()) { return $content; } // are we in a feed if (is_feed()) { return $content; } // are we in a feed - for future investigation if (is_feed()) { $button = ahsfl_generate_static_button(); $where = 'ahsfl_rss_where'; } else { $button = ahsfl_generate_button(); $where = 'ahsfl_where'; } // are we displaying in a feed if (is_feed() && get_option('ahsfl_display_rss') == null) { return $content; } // are we just using the shortcode if (get_option($where) == 'shortcode') { return str_replace('[facebook-like-button]', $button, $content); } else { // if we have switched the button off if (get_post_meta($post->ID, 'facebooklikebutton') == null) { if (get_option($where) == 'beforeandafter') { // adding it before and after return $button . $content . $button; } else if (get_option($where) == 'before') { // just before return $button . $content; } else { // just after return $content . $button; } } else { // not at all return $content; } } } // Manual output function facebooklikebutton() { if (get_option('ahsfl_where') == 'manual') { return ahsfl_generate_button(); } else { return false; } } // Remove the filter excerpts function ahsfl_remove_filter($content) { if (!is_feed()) { remove_action('the_content', 'ahsfl_update'); } return $content; } function ahsfl_head() { global $post; if (get_option('ahsfl_defaultimg') == null) $defaultimg = get_bloginfo('stylesheet_directory').'/images/default_icon.jpg'; else $defaultimg = get_option('ahsfl_defaultimg'); if (function_exists('get_the_image')) { $img = get_the_image(array('post_id'=>$post->ID,'format'=>'array', 'default_size'=>'thumbnail','default_image'=>$defaultimg)); $postimg = $img['url']; } else { $postimg = $defaultimg; } ?>

Settings for Facebook 'Like' button

Display name="ahsfl_display_page" id="ahsfl_display_page" group="ahsfl_display"/>
name="ahsfl_display_front" id="ahsfl_display_front" group="ahsfl_display"/>
Position
Type name="ahsfl_version" id="ahsfl_version_standard" group="ahsfl_version"/>
name="ahsfl_version" id="ahsfl_version_button_count" group="ahsfl_version" />
Verb to use name="ahsfl_verb" id="ahsfl_verb_like" group="ahsfl_verb"/>
name="ahsfl_verb" id="ahsfl_verb_recommend" group="ahsfl_verb" />
Show faces below button? name="ahsfl_faces" id="ahsfl_faces_true" group="ahsfl_faces"/>
name="ahsfl_faces" id="ahsfl_faces_true" group="ahsfl_faces" />
Color Scheme name="ahsfl_colorscheme" id="ahsfl_colorscheme_light" group="ahsfl_colorscheme"/>
name="ahsfl_colorscheme" id="ahsfl_colorscheme_dark" group="ahsfl_colorscheme" />
name="ahsfl_colorscheme" id="ahsfl_colorscheme_evil" group="ahsfl_colorscheme" />
px wide   by   px high
What width do you want it to be? Generally, you'll want 200-450 for the standard widget and 100 for the small version. The default height is 40px; if you're using the small version of the button 20px is tall enough; if you're showing faces, you'll want more height.

Add style to the div that surrounds the button E.g. float: left; margin-right: 10px;

What is the default image for your website, in case the single post doesn't have an image, or in case the user wants to 'like' a whole page. Use a full URL, starting with http://