コード例 #1
0
function thematic_widgets_init()
{
    // Define array for the widgetized areas
    $thematic_widgetized_areas = array('Header Widgets' => array('admin_menu_order' => 100, 'args' => array('name' => 'Header Widgets', 'id' => 'hdr-widgets', 'description' => __('The header widget area for additional mast head items.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_header', 'function' => 'thematic_widget_header', 'priority' => 10), 'Primary Aside' => array('admin_menu_order' => 200, 'args' => array('name' => 'Primary Aside', 'id' => 'primary-aside', 'description' => __('The primary widget area, most often used as a sidebar.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_primary_aside', 'function' => 'thematic_primary_aside', 'priority' => 10), 'Secondary Aside' => array('admin_menu_order' => 300, 'args' => array('name' => 'Secondary Aside', 'id' => 'secondary-aside', 'description' => __('The secondary widget area, most often used as a sidebar.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_secondary_aside', 'function' => 'thematic_secondary_aside', 'priority' => 10), '1st Subsidiary Aside' => array('admin_menu_order' => 400, 'args' => array('name' => '1st Subsidiary Aside', 'id' => '1st-subsidiary-aside', 'description' => __('The 1st widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_1st_subsidiary_aside', 'priority' => 30), '2nd Subsidiary Aside' => array('admin_menu_order' => 500, 'args' => array('name' => '2nd Subsidiary Aside', 'id' => '2nd-subsidiary-aside', 'description' => __('The 2nd widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_2nd_subsidiary_aside', 'priority' => 50), '3rd Subsidiary Aside' => array('admin_menu_order' => 600, 'args' => array('name' => '3rd Subsidiary Aside', 'id' => '3rd-subsidiary-aside', 'description' => __('The 3rd widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_3rd_subsidiary_aside', 'priority' => 70), 'Index Top' => array('admin_menu_order' => 700, 'args' => array('name' => 'Index Top', 'id' => 'index-top', 'description' => __('The top widget area displayed on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_top', 'function' => 'thematic_index_top', 'priority' => 10), 'Index Insert' => array('admin_menu_order' => 800, 'args' => array('name' => 'Index Insert', 'id' => 'index-insert', 'description' => __('The widget area inserted after x posts on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_insert', 'function' => 'thematic_index_insert', 'priority' => 10), 'Index Bottom' => array('admin_menu_order' => 900, 'args' => array('name' => 'Index Bottom', 'id' => 'index-bottom', 'description' => __('The bottom widget area displayed on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_bottom', 'function' => 'thematic_index_bottom', 'priority' => 10), 'Single Top' => array('admin_menu_order' => 1000, 'args' => array('name' => 'Single Top', 'id' => 'single-top', 'description' => __('The top widget area displayed on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_top', 'function' => 'thematic_single_top', 'priority' => 10), 'Single Insert' => array('admin_menu_order' => 1100, 'args' => array('name' => 'Single Insert', 'id' => 'single-insert', 'description' => __('The widget area inserted between the post and the comments on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_insert', 'function' => 'thematic_single_insert', 'priority' => 10), 'Single Bottom' => array('admin_menu_order' => 1200, 'args' => array('name' => 'Single Bottom', 'id' => 'single-bottom', 'description' => __('The bottom widget area displayed on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_bottom', 'function' => 'thematic_single_bottom', 'priority' => 10), 'Page Top' => array('admin_menu_order' => 1300, 'args' => array('name' => 'Page Top', 'id' => 'page-top', 'description' => __('The top widget area displayed on a page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_page_top', 'function' => 'thematic_page_top', 'priority' => 10), 'Page Bottom' => array('admin_menu_order' => 1400, 'args' => array('name' => 'Page Bottom', 'id' => 'page-bottom', 'description' => __('The bottom widget area displayed on a page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_page_bottom', 'function' => 'thematic_page_bottom', 'priority' => 10));
    $thematic_widgetized_areas = apply_filters('thematic_widgetized_areas', $thematic_widgetized_areas);
    if (!function_exists('register_sidebars')) {
        return;
    }
    foreach ($thematic_widgetized_areas as $key => $value) {
        register_sidebar($thematic_widgetized_areas[$key]['args']);
        if (!has_action($thematic_widgetized_areas[$key]['action_hook'], $thematic_widgetized_areas[$key]['function'])) {
            add_action($thematic_widgetized_areas[$key]['action_hook'], $thematic_widgetized_areas[$key]['function'], $thematic_widgetized_areas[$key]['priority']);
        }
    }
    // we will check for a Thematic widgets directory and and add and activate additional widgets
    // Thanks to Joern Kretzschmar
    $widgets_dir = @dir(ABSPATH . '/wp-content/themes/' . get_template() . '/widgets');
    if ($widgets_dir) {
        while (($widgetFile = $widgets_dir->read()) !== false) {
            if (!preg_match('|^\\.+$|', $widgetFile) && preg_match('|\\.php$|', $widgetFile)) {
                include ABSPATH . '/wp-content/themes/' . get_template() . '/widgets/' . $widgetFile;
            }
        }
    }
    // we will check for the child themes widgets directory and add and activate additional widgets
    // Thanks to Joern Kretzschmar
    $widgets_dir = @dir(ABSPATH . '/wp-content/themes/' . get_stylesheet() . '/widgets');
    if (TEMPLATENAME != THEMENAME && $widgets_dir) {
        while (($widgetFile = $widgets_dir->read()) !== false) {
            if (!preg_match('|^\\.+$|', $widgetFile) && preg_match('|\\.php$|', $widgetFile)) {
                include ABSPATH . '/wp-content/themes/' . get_stylesheet() . '/widgets/' . $widgetFile;
            }
        }
    }
    // Remove WP default Widgets
    // WP 2.8 function using $widget_class
    if (function_exists('unregister_widget')) {
        unregister_widget('WP_Widget_Meta');
        unregister_widget('WP_Widget_Search');
        unregister_widget('');
        // pre WP 2.8 function using $id
    } else {
        unregister_widget_control('meta');
        unregister_widget_control('search');
    }
    // Finished intializing Widgets plugin, now let's load the thematic default widgets
    register_sidebar_widget(__('Search', 'thematic'), 'widget_thematic_search', null, 'search');
    unregister_widget_control('search');
    register_sidebar_widget(__('Meta', 'thematic'), 'widget_thematic_meta', null, 'meta');
    unregister_widget_control('meta');
    register_sidebar_widget(array(__('RSS Links', 'thematic'), 'widgets'), 'widget_thematic_rsslinks');
    register_widget_control(array(__('RSS Links', 'thematic'), 'widgets'), 'widget_thematic_rsslinks_control', 300, 90);
    // Pre-set Widgets
    $preset_widgets = array('primary-aside' => array('search', 'pages', 'categories', 'archives'), 'secondary-aside' => array('links', 'rss-links', 'meta'));
    if (isset($_GET['activated'])) {
        update_option('sidebars_widgets', apply_filters('thematic_preset_widgets', $preset_widgets));
    }
}
コード例 #2
0
function thematic_widgets_array()
{
    // Define array for the widgetized areas
    $thematic_widgetized_areas = array('Primary Aside' => array('admin_menu_order' => 100, 'args' => array('name' => 'Primary Aside', 'id' => 'primary-aside', 'description' => __('The primary widget area, most often used as a sidebar.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_primary_aside', 'function' => 'thematic_primary_aside', 'priority' => 10), 'Secondary Aside' => array('admin_menu_order' => 200, 'args' => array('name' => 'Secondary Aside', 'id' => 'secondary-aside', 'description' => __('The secondary widget area, most often used as a sidebar.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_secondary_aside', 'function' => 'thematic_secondary_aside', 'priority' => 10), '1st Subsidiary Aside' => array('admin_menu_order' => 300, 'args' => array('name' => '1st Subsidiary Aside', 'id' => '1st-subsidiary-aside', 'description' => __('The 1st widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_1st_subsidiary_aside', 'priority' => 30), '2nd Subsidiary Aside' => array('admin_menu_order' => 400, 'args' => array('name' => '2nd Subsidiary Aside', 'id' => '2nd-subsidiary-aside', 'description' => __('The 2nd widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_2nd_subsidiary_aside', 'priority' => 50), '3rd Subsidiary Aside' => array('admin_menu_order' => 500, 'args' => array('name' => '3rd Subsidiary Aside', 'id' => '3rd-subsidiary-aside', 'description' => __('The 3rd widget area in the footer.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_subsidiaries', 'function' => 'thematic_3rd_subsidiary_aside', 'priority' => 70), 'Index Top' => array('admin_menu_order' => 600, 'args' => array('name' => 'Index Top', 'id' => 'index-top', 'description' => __('The top widget area displayed on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_top', 'function' => 'thematic_index_top', 'priority' => 10), 'Index Insert' => array('admin_menu_order' => 700, 'args' => array('name' => 'Index Insert', 'id' => 'index-insert', 'description' => __('The widget area inserted after x posts on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_insert', 'function' => 'thematic_index_insert', 'priority' => 10), 'Index Bottom' => array('admin_menu_order' => 800, 'args' => array('name' => 'Index Bottom', 'id' => 'index-bottom', 'description' => __('The bottom widget area displayed on the index page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_index_bottom', 'function' => 'thematic_index_bottom', 'priority' => 10), 'Single Top' => array('admin_menu_order' => 900, 'args' => array('name' => 'Single Top', 'id' => 'single-top', 'description' => __('The top widget area displayed on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_top', 'function' => 'thematic_single_top', 'priority' => 10), 'Single Insert' => array('admin_menu_order' => 1000, 'args' => array('name' => 'Single Insert', 'id' => 'single-insert', 'description' => __('The widget area inserted between the post and the comments on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_insert', 'function' => 'thematic_single_insert', 'priority' => 10), 'Single Bottom' => array('admin_menu_order' => 1100, 'args' => array('name' => 'Single Bottom', 'id' => 'single-bottom', 'description' => __('The bottom widget area displayed on a single post.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_single_bottom', 'function' => 'thematic_single_bottom', 'priority' => 10), 'Page Top' => array('admin_menu_order' => 1200, 'args' => array('name' => 'Page Top', 'id' => 'page-top', 'description' => __('The top widget area displayed on a page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_page_top', 'function' => 'thematic_page_top', 'priority' => 10), 'Page Bottom' => array('admin_menu_order' => 1300, 'args' => array('name' => 'Page Bottom', 'id' => 'page-bottom', 'description' => __('The bottom widget area displayed on a page.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()), 'action_hook' => 'widget_area_page_bottom', 'function' => 'thematic_page_bottom', 'priority' => 10));
    return apply_filters('thematic_widgetized_areas', $thematic_widgetized_areas);
}
コード例 #3
0
function pickleplease_sidebars_init()
{
    // Register the New Footer Sidebar
    register_sidebar(array('name' => 'New Sidebar', 'id' => 'new-sidebar', 'description' => __('This is a right column widget area.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()));
    // Unregister and sidebars you donÕt need based on its ID.
    // For a full list of Thematic sidebar IDs, look at /thematc/library/extensions/widgets-extensions.php
    //unregister_sidebar('primary-aside');
    unregister_sidebar('secondary-aside');
    unregister_sidebar('index-top');
    unregister_sidebar('index-insert');
    unregister_sidebar('index-bottom');
    unregister_sidebar('single-top');
    unregister_sidebar('single-insert');
    unregister_sidebar('single-bottom');
    unregister_sidebar('page-top');
    unregister_sidebar('page-bottom');
}
コード例 #4
0
ファイル: widget-areas.php プロジェクト: jmawebco/wordpress1
function wicked_footer_aside()
{
    register_sidebar(array('name' => 'Main Footer Aside', 'id' => 'footer-aside', 'description' => __('A widget area in the footer, above the subsidiary asides.', 'thematic'), 'before_widget' => thematic_before_widget(), 'after_widget' => thematic_after_widget(), 'before_title' => thematic_before_title(), 'after_title' => thematic_after_title()));
}