/**
 * Register the sidebars for each portfolio
 */
function yiw_portfolio_register_sidebars()
{
    $portfolios = yiw_portfolios();
    foreach ($portfolios as $pt => $the_) {
        register_sidebar(yiw_sidebar_args($the_['title'] . ' Sidebar', __('The sidebar used in Full description layout and in single portfolio template of "' . $the_['title'] . '" post type.', 'yiw'), 'widget', 'h2'));
    }
}
Example #2
0
function yiw_theme_setup()
{
    global $wp_version;
    // This theme styles the visual editor with editor-style.css to match the theme style.
    add_editor_style('css/editor-style.css');
    // This theme uses post thumbnails
    add_theme_support('post-thumbnails');
    // This theme uses the menues
    add_theme_support('menus');
    // Add default posts and comments RSS feed links to head
    add_theme_support('automatic-feed-links');
    // Post Format support.
    //add_theme_support( 'post-formats', array( 'aside', 'gallery' ) );
    // Post Format support.
    //add_theme_support( 'post-formats', array( 'aside', 'gallery' ) ); // Your changeable header business starts here
    if (!defined('HEADER_TEXTCOLOR')) {
        define('HEADER_TEXTCOLOR', '');
    }
    // No CSS, just IMG call. The %s is a placeholder for the theme template directory URI.
    if (!defined('HEADER_IMAGE')) {
        define('HEADER_IMAGE', '%s/images/fixed-images/001.jpg');
    }
    // The height and width of your custom header. You can hook into the theme's own filters to change these values.
    // Add a filter to twentyten_header_image_width and twentyten_header_image_height to change these values.
    define('HEADER_IMAGE_WIDTH', apply_filters('yiw_header_image_width', 960));
    define('HEADER_IMAGE_HEIGHT', apply_filters('yiw_header_image_height', 338));
    // We'll be using post thumbnails for custom header images on posts and pages.
    // We want them to be 940 pixels wide by 198 pixels tall.
    // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php.
    //set_post_thumbnail_size( HEADER_IMAGE_WIDTH, HEADER_IMAGE_HEIGHT, true );
    $image_sizes = array('thumb_recentposts' => array(55, 55, true), 'thumb_testimonial' => array(94, 94, true), 'thumb-slider-elastic' => array(150, 59, true), 'thumb_portfolio_3cols' => array(280, 143, true, '#portfolio li img, #portfolio li .thumb, '), 'thumb_portfolio_slider' => array(205, 118, true, '.portfolio-slider li a img, .portfolio-slider li a, .portfolio-slider li'), 'thumb_portfolio_big' => array(617, 295, true, '#portfolio-bigimage img'), 'thumb_gallery' => array(208, 168, true, '.gallery-wrap li img, .gallery-wrap .internal_page_item'), 'thumb_more_projects' => array(86, 86, true), 'blog_elegant' => array(450, 0, true), 'blog_big' => array(720, 0, true), 'blog_small' => array(288, 266, true), 'nivo_slider' => array(608, 269, true), 'features_tab_icon' => array(20, 20, true));
    yiw_set_sizes_theme_option($image_sizes);
    foreach ($image_sizes as $id_size => $size) {
        add_image_size($id_size, apply_filters('yiw_' . $id_size . '_width', $size[0]), apply_filters('yiw_' . $id_size . '_height', $size[1]), $size[2]);
    }
    //     global $_wp_additional_image_sizes;
    //     yiw_debug($_wp_additional_image_sizes);
    // Don't support text inside the header image.
    if (!defined('NO_HEADER_TEXT')) {
        define('NO_HEADER_TEXT', true);
    }
    // Add a way for the custom header to be styled in the admin panel that controls
    // custom headers. See twentyten_admin_header_style(), below.
    if (version_compare($wp_version, '3.4', ">=")) {
        add_theme_support('custom-header', array('admin-head-callback' => 'yiw_admin_header_style'));
    } else {
        add_custom_image_header('', 'yiw_admin_header_style');
    }
    // ... and thus ends the changeable header business.
    // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI.
    register_default_headers(array('design1' => array('url' => '%s/images/fixed-images/001.jpg', 'thumbnail_url' => '%s/images/fixed-images/thumb/001.jpg', 'description' => __('Design', 'yiw') . ' 1'), 'design2' => array('url' => '%s/images/fixed-images/002.jpg', 'thumbnail_url' => '%s/images/fixed-images/thumb/002.jpg', 'description' => __('Design', 'yiw') . ' 2'), 'design3' => array('url' => '%s/images/fixed-images/003.jpg', 'thumbnail_url' => '%s/images/fixed-images/thumb/003.jpg', 'description' => __('Design', 'yiw') . ' 3'), 'design4' => array('url' => '%s/images/fixed-images/004.jpg', 'thumbnail_url' => '%s/images/fixed-images/thumb/004.jpg', 'description' => __('Design', 'yiw') . ' 4'), 'design5' => array('url' => '%s/images/fixed-images/005.jpg', 'thumbnail_url' => '%s/images/fixed-images/thumb/005.jpg', 'description' => __('Design', 'yiw') . ' 5')));
    $locale = get_locale();
    $locale_file = TEMPLATEPATH . "/languages/{$locale}.php";
    if (is_readable($locale_file)) {
        require_once $locale_file;
    }
    // This theme uses wp_nav_menu() in more locations.
    register_nav_menus(array('nav' => __('Navigation'), 'topbar' => __('Navigation in the top bar', 'yiw')));
    // images size
    //add_image_size( 'thumb', 100, 100 );
    // sidebars registers
    register_sidebar(yiw_sidebar_args('Default Sidebar', __('This sidebar will be shown in all pages with empty sidebar or without any sidebat set.', 'yiw')));
    register_sidebar(yiw_sidebar_args('Blog Sidebar', __('The sidebar showed on page with Blog template', 'yiw')));
    register_sidebar(yiw_sidebar_args('Gallery Sidebar', __('The sidebar shown on Gallery pages', 'yiw')));
    register_sidebar(yiw_sidebar_args('Shop Sidebar', __('The sidebar for all shop pages', 'yiw')));
    register_sidebar(yiw_sidebar_args('Testimonials Sidebar', __('The sidebar used in Testimonials Single Template.', 'yiw'), 'widget', 'h3'));
    if (is_plugin_active('qtranslate/qtranslate.php')) {
        register_sidebar(yiw_sidebar_args('qTranslate row', __('The sidebar used in the topbar. ONLY For qTranslate widget.', 'yiw'), 'widget', 'h3'));
    }
    do_action('yiw_register_sidebars');
    // add sidebar created from plugin
    $sidebars = maybe_unserialize(yiw_get_option('sidebars'));
    if (is_array($sidebars) && !empty($sidebars)) {
        foreach ($sidebars as $sidebar) {
            register_sidebar(yiw_sidebar_args($sidebar, '', 'widget', 'h3'));
        }
    }
    // footer sidebars
    for ($i = 1; $i <= yiw_get_option('footer_rows', 0); $i++) {
        register_sidebar(yiw_sidebar_args("Footer Row {$i}", __("The widget area nr. {$i} used in Footer section", 'yiw'), 'widget', 'h3'));
    }
}