'Widgets' == Frequently Asked Questions == = How do I upload an image? = The JetBook Black Widget does not provide a mechanism for uploading images or files. You can however upload an image in the 'Write' section of Wordpress. From there you can click on the 'Add an Image' icon (next to 'Add Media' label). After uploading an image, copy the 'Link URL' for use in your JetBook Black Widget. = How many images can be display? = Each instance of the widget can only display one image, but you can create as many instances as you need. == Screenshots == 1. JetBook Black Widget control interface 2. JetBook Black Widget in sidebar */ ?> $widget_args ); $widget_args = wp_parse_args( $widget_args, array( 'number' => -1 ) ); extract( $widget_args, EXTR_SKIP ); // Data is stored as array: array( number => data for that instance of the widget, ... ) $options = get_option('widget_jetbookblack'); if ( !isset($options[$number]) ) return; if ($options[$number]['link']) { if ($options[$number]['new_window']) $before_image = ""; else $before_image = ""; $after_image = ""; } if ($options[$number]['image']) $title = preg_replace('/\?.*/', "", basename($options[$number]['image'])); ?>
'widget_jetbookblack', 'description' => __('Display an image')); $control_ops = array( 'id_base' => 'jetbookblack'); $name = __('JetBook Black Widget'); $registered = false; foreach ( array_keys($options) as $o ) { // Old widgets can have null values for some reason if ( !isset($options[$o]['image']) ) continue; $id = "jetbookblack-$o"; // Never never never translate an id $registered = true; wp_register_sidebar_widget( $id, $name, 'widget_jetbookblack', $widget_ops, array( 'number' => $o ) ); wp_register_widget_control( $id, $name, 'widget_jetbookblack_control', $control_ops, array( 'number' => $o ) ); } // If there are none, we register the widget's existance with a generic template if ( !$registered ) { wp_register_sidebar_widget( 'jetbookblack-1', $name, 'widget_jetbookblack', $widget_ops, array( 'number' => -1 ) ); wp_register_widget_control( 'jetbookblack-1', $name, 'widget_jetbookblack_control', $control_ops, array( 'number' => -1 ) ); } } // Hook for the registration add_action( 'widgets_init', 'widget_jetbookblack_register' ) ?>