Пример #1
0
 /**
  * How to display the widget on the screen.
  */
 function widget($args, $instance)
 {
     extract($args);
     global $wpdb;
     $sgc_table = $wpdb->prefix . "stoutgc";
     /* Our variables from the widget settings. */
     $id = $instance['id'];
     $calendars = $wpdb->get_results("SELECT id,name FROM {$sgc_table} WHERE id = {$id} LIMIT 1");
     foreach ($calendars as $calendar) {
         $title = stripslashes(apply_filters('widget_title', $calendar->name));
     }
     $show_name = isset($instance['show_name']) ? $instance['show_name'] : false;
     /* Before widget (defined by themes). */
     echo $before_widget;
     /* Display the widget title if one was input (before and after defined by themes). */
     if ($show_name) {
         echo $before_title . $title . $after_title;
     }
     echo stout_gc($id);
     /* After widget (defined by themes). */
     echo $after_widget;
 }
function stout_gc_func($atts)
{
    extract(shortcode_atts(array('id' => '1', 'show_name' => 'FALSE'), $atts));
    return stout_gc($id, $show_name);
}