I'm still trying to wrap my head around this, but I just can't get it right. Hoping someone can help. I am attempting to make a custom facebook like box widget with xfbml. If you are familiar with the wordpress widget api, I am having difficulty figuring out what to put in the widget, update, and form functions. I have the xfbml code, and a xhtml strict dtd validating .js file.
class my_fblikebox extends WP_Widget {
function organicsoul_fblikebox() {
$widget_ops = array('classname' => 'widget_fblikebox', 'description' => __('Displays A Facebook Page Like Box'));
$control_ops = array('width' => 400, 'height' => 350);
$this->WP_Widget('my_fblikebox', __('Facebook Page Like Box'), $widget_ops, $control_ops);
}
function widget( $args, $instance ) {
extract($args);
echo $before_widget;
echo '<h3 class="widget-fblikebox">' . $instance['title'] . '</h3>';
echo '<div class="sidebar-fblikebox">';
//don't know what to put in here to display the like box
echo '</div>';
echo $after_widget;
function update($new_instance, $old_instance) {
$instance = $old_instance;
$instance['title'] = strip_tags($new_instance['title']);
return $instance;
}
function form($instance) {
$instance = wp_parse_args( (array) $instance, array('title'=>__('Facebook Like Box')) );
$title = htmlspecialchars($instance['title']);
//don't know what to put in here for the client to just input their facebook page url.
?>
<?php
}
}
add_action('widgets_init', create_function('', 'return register_widget("my_fblikebox");'));