in WordPress

Facebook fanbox wordpress plugin

It’s just a simple fanbox widget as wordpress plugin, nothing to explain. But I made my own version ?


  • iframe method
  • auto detect ie(internet explorer), because sometimes it’s make problem for ie and option to use as iframe only for ie !
  • jquery based document ready facebook load ! Not clear ? see bellow

One thing to note that I used a way to load the facebook js script after loading jquery as normally in wordpress site front end we use jquery and many plugin uses this… so we can take that jquery is using default. So I loaded the fb js using wp_enqueue function and then called the fb init function after the document is loaded using jquery dom ready function 😛 … It’s just an experiment about slow loading of facebook fanbox widget in wordpress 😀


[download id=”23″]

If you just download with no comment and no recommendation to others, then I am planning to hate you 😛
Man at least share in social network and give me traffic so that I can have more money from ads 🙁

Good morning. It’s just morning after working whole night and I am feeling too hungry 🙂

Code Example

[code language=”php”]
function widget( $args, $instance ) {
extract( $args );
global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone;
/* Our variables from the widget settings. */
$title = apply_filters(‘widget_title’, $instance[‘title’] );
$profileid = $instance[‘profileid’]; //name or profile id , not both
$apikey = isset( $instance[‘apikey’])? $instance[‘apikey’] : ”;
$stream = isset( $instance[‘stream’] ) ? $instance[‘stream’] : 0;
$connections = isset( $instance[‘connections’] )? (($instance[‘connections’] > 100)? 100: intval($instance[‘connections’])): 10; //Specifying 0 hides the list of fans in the Fan Box. You cannot display more than 100 fans. (Default value is 10 connections.)
$width = isset( $instance[‘width’] )? (($instance[‘width’] < 200)? 200: intval($instance[‘width’])): 300; // at least 200 pixels wide at minimum. (Default value is 300 pixels.)
$height = isset( $instance[‘height’] )? $instance[‘height’]: 554;
$css = isset( $instance[‘css’]) ? $instace[‘css’]:”;
$logobar = isset( $instance[‘logobar’] ) ? $instance[‘logobar’] : 1;
$iframe = isset( $instance[‘iframe’])? $instance[‘iframe’] : 0;
$locale = isset( $instance[‘locale’])? $instance[‘locale’]: ‘en_US’;
$iframeie = isset( $instance[‘iframeie’] ) ? $instance[‘iframeie’] : 1; // use iframe for ie , auto detect
$usejquery = isset( $instance[‘usejquery’] ) ? $instance[‘usejquery’] : 1;
/* Before widget (defined by themes). */
echo $before_widget;

/* Display the widget title if one was input (before and after defined by themes). */
if ( $title )
echo $before_title . $title . $after_title;

if(($is_IE && $iframeie) || $iframe || $apikey == ”)
//echo ‘yes’;
echo ‘<iframe scrolling="no" frameborder="0" src="’.$profileid.’&amp;stream=’.$stream.’&amp;connections=’.$connections.’&amp;logobar=’.$logo.’&amp;css=’.$css.’?’.mktime().’" style="border: none; width: ‘.$width.’px; height:’.$height.’px;">&nbsp;</iframe>’;
wp_enqueue_script(‘fbjs’, ‘’, array(‘jquery’), null);
echo ‘<fb:fan profile_id="’.$profileid.’" width="’.$width.’" connections="’.$connections.’" stream="’.$stream.’" header="’.$logobar.’"></fb:fan>’;
echo ‘<script type="text/javascript">jQuery(document).ready(function() {
echo ‘<script type="text/javascript" src=""></script>’;
echo ‘<script type="text/javascript"> FB.init("’.$apikey.’"); </script>’;

/* After widget (defined by themes). */
echo $after_widget;

  1. I can't seem to get more then 2 rows to show up. IF I select show 15 six show up on list.

    How do I adjust the height to accommodate more in list? I put high values in height but that value does not seem to change height of the widget.

  2. <blockquote cite="comment-10451">

    i m gonna use it r8 now. But Manchu Da please correct it“befault”

    @Sammo thank for use and notice the typo.

  3. i m gonna use it r8 now.

    But Manchu Da please correct it "befault"

  4. I am not going to download it, but will recommend it to others. Will try to get more traffics to your site 🙂 since I think you work very hard, and very generous. We all should do the same as you.

    Best Luck Manchu


Comments are closed.