Example #1
0
/**
 * Set up all theme data.
 * 
 * @return void
 * @since 1.0.0
 */
function yit_setup_theme()
{
    //Content width. WP require it. So give to WordPress what is of WordPress
    if (!isset($content_width)) {
        $content_width = yit_get_option('container-width');
    }
    //This theme have a CSS file for the editor TinyMCE
    add_editor_style('css/editor-style.css');
    //This theme support 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');
    //This theme support post formats
    add_theme_support('post-formats', apply_filters('yit_post_formats_support', array('gallery', 'audio', 'video', 'quote')));
    if (!defined('HEADER_TEXTCOLOR')) {
        define('HEADER_TEXTCOLOR', '');
    }
    // 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', 1170));
    define('HEADER_IMAGE_HEIGHT', apply_filters('yiw_header_image_height', 410));
    // Don't support text inside the header image.
    if (!defined('NO_HEADER_TEXT')) {
        define('NO_HEADER_TEXT', true);
    }
    //This theme support custom header
    add_theme_support('custom-header');
    //This theme support custom backgrounds
    add_theme_support('custom-backgrounds');
    // 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('blog_small_image' => array(554, 577, true), 'blog_big' => array(864, 421, true), 'blog_thumb' => array(49, 49, true), 'section_blog' => array(261, 173, true), 'section_services' => array(175, 175, true), 'section_portfolio' => array(270, 270, true), 'section_portfolio_large' => array(270, 370, true), 'section_portfolio_small' => array(270, 170, true), 'thumb-testimonial' => array(160, 160, true), 'thumb-testimonial-quote' => array(160, 160, true), 'thumb_portfolio_fulldesc_related' => array(270, 170, true), 'thumb_portfolio_bigimage' => array(656, 0), 'thumb_portfolio_filterable' => array(270, 168, true), 'thumb_portfolio_fulldesc' => array(574, 340, true), 'thumb_portfolio_fulldesc_big' => array(1158, 400, true), 'portfolio_gallery_thumb' => array(65, 65, true), 'section_video' => array(162, 136, true), 'thumb_portfolio_2cols' => array(570, 324, true), 'thumb_portfolio_3cols' => array(370, 216, true), 'thumb_portfolio_4cols' => array(270, 172, true), 'accordion_thumb' => array(266, 266, true), 'team_rounded_thumb' => array(130, 130, true), 'team_professional_thumb' => array(270, 270, true), 'team_professional_mini_thumb' => array(70, 70, true), 'featured_project_thumb' => array(320, 154, true), 'thumb_portfolio_slide' => array(560, 377, true), 'nav_menu' => array(170, 0), 'teaser_widget' => array(258, 0, false), 'sc_portfolio_3cols' => array(360, 260, true));
    $image_sizes = apply_filters('yit_add_image_size', $image_sizes);
    foreach ($image_sizes as $id_size => $size) {
        yit_add_image_size($id_size, apply_filters('yit_' . $id_size . '_width', $size[0]), apply_filters('yit_' . $id_size . '_height', $size[1]), isset($size[2]) ? $size[2] : false);
    }
    //Register theme default header. Usually one
    //     register_default_headers( array(
    //         'theme_header' => array(
    //             'url' => '%s/images/headers/001.jpg',
    //             'thumbnail_url' => '%s/images/headers/thumb/001.jpg',
    //             /* translators: header image description */
    //             'description' => __( 'Design', 'yit' ) . ' 1'
    //         )
    //     ) );
    //Set localization and load language file
    $locale = get_locale();
    $locale_file = YIT_THEME_PATH . "/languages/{$locale}.php";
    if (is_readable($locale_file)) {
        require_once $locale_file;
    }
    //Register menus
    register_nav_menus(array('nav' => __('Main Navigation', 'yit'), 'my-account-menu' => __('My Account Header Menu', 'yit'), 'my-account-page' => __('My Account Page Menu', 'yit')));
    //create the main menu if it doesn't exist
    $menuname = 'Main Navigation';
    if (!wp_get_nav_menu_object($menuname)) {
        $menu_id = wp_create_nav_menu($menuname);
        wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('HOME'), 'menu-item-classes' => 'home', 'menu-item-url' => home_url(), 'menu-item-status' => 'publish'));
        if (!has_nav_menu('nav')) {
            $locations = get_theme_mod('nav_menu_locations');
            $locations['nav'] = $menu_id;
            set_theme_mod('nav_menu_locations', $locations);
        }
    }
    /*
        //create the menu items if they don't exist
        $menuname = 'Welcome Menu';
        if( !wp_get_nav_menu_object( $menuname ) ) {
            $menu_id = wp_create_nav_menu($menuname);
    
            if( is_shop_installed() ) {
    
                if( get_option('woocommerce_myaccount_page_id') ) {
                    wp_update_nav_menu_item($menu_id, 0, array(
                        'menu-item-title' => __('My Account', 'yit'),
                        'menu-item-object' => 'page',
                        'menu-item-object-id' => get_option('woocommerce_myaccount_page_id'),
                        'menu-item-type' => 'post_type',
                        'menu-item-status' => 'publish'));
                }
    
                if ( get_option('woocommerce_change_password_page_id') ) {
                    wp_update_nav_menu_item($menu_id, 0, array(
                        'menu-item-title' => __('Change Password', 'yit'),
                        'menu-item-object' => 'page',
                        'menu-item-object-id' => get_option('woocommerce_change_password_page_id'),
                        'menu-item-type' => 'post_type',
                        'menu-item-status' => 'publish'));
                }
    
                if ( get_option('woocommerce_edit_address_page_id') ) {
                    wp_update_nav_menu_item($menu_id, 0, array(
                        'menu-item-title' => __('Edit My Address', 'yit'),
                        'menu-item-object' => 'page',
                        'menu-item-object-id' => get_option('woocommerce_edit_address_page_id'),
                        'menu-item-type' => 'post_type',
                        'menu-item-status' => 'publish'));
                }
    
                if ( get_option('woocommerce_view_order_page_id') ) {
                    wp_update_nav_menu_item($menu_id, 0, array(
                        'menu-item-title' => __('View Orders', 'yit'),
                        'menu-item-object' => 'page',
                        'menu-item-object-id' => get_option('woocommerce_view_order_page_id'),
                        'menu-item-type' => 'post_type',
                        'menu-item-status' => 'publish'));
                }
    
    
                if ( get_option('yith_wcwl_wishlist_page_id') ) {
                    wp_update_nav_menu_item($menu_id, 0, array(
                        'menu-item-title' => __('Wishlist', 'yit'),
                        'menu-item-object' => 'page',
                        'menu-item-object-id' => get_option('yith_wcwl_wishlist_page_id'),
                        'menu-item-type' => 'post_type',
                        'menu-item-status' => 'publish'));
                }
    
                if( defined('YITH_WOOCOMPARE') && YITH_WOOCOMPARE ) {
                    wp_update_nav_menu_item($menu_id, 0, array(
                        'menu-item-title' =>  __('Compare', 'yit'),
                        'menu-item-classes' => 'yith-woocompare-open',
                        'menu-item-url' => '#',
                        'menu-item-status' => 'publish'));
                }
    
            }
    
            wp_update_nav_menu_item($menu_id, 0, array(
                'menu-item-title' =>  __('{logout}'),
                'menu-item-classes' => 'logout',
                'menu-item-url' => '#',
                'menu-item-status' => 'publish'));
    
            if( !has_nav_menu( 'welcome-menu' ) ){
                $locations = get_theme_mod('nav_menu_locations');
                $locations['welcome-menu'] = $menu_id;
                set_theme_mod( 'nav_menu_locations', $locations );
            }
        }
    */
    //Register sidebars
    register_sidebar(yit_sidebar_args('Default Sidebar'));
    register_sidebar(yit_sidebar_args('Topbar Left', 'Left widget area for Tob Bar'));
    register_sidebar(yit_sidebar_args('Topbar Right', 'Right widget area for Tob Bar'));
    register_sidebar(yit_sidebar_args('Header Sidebar', 'Widget area near the navigation'));
    register_sidebar(yit_sidebar_args('Home Row', 'The widgets area used in the page with home template', 'home-widget span3'));
    register_sidebar(yit_sidebar_args('Blog Sidebar'));
    register_sidebar(yit_sidebar_args('Faq Sidebar', 'The widgets area used in the faqs page'));
    register_sidebar(yit_sidebar_args('404 Sidebar'));
    register_sidebar(yit_sidebar_args('Contact Sidebar', 'Widgets area for the contact page'));
    /**********************
     * Re-enable this sidebar when the skin 3 will be added
     *********************/
    //register_sidebar( yit_sidebar_args( 'Header Sidebar', 'Widget area for Header', 'widget' ) );
    //User defined sidebars
    do_action('yit_register_sidebars');
    //Register custom sidebars
    $sidebars = maybe_unserialize(yit_get_option('custom-sidebars'));
    if (is_array($sidebars) && !empty($sidebars)) {
        foreach ($sidebars as $sidebar) {
            register_sidebar(yit_sidebar_args($sidebar, '', 'widget', apply_filters('yit_custom_sidebar_title_wrap', 'h3')));
        }
    }
    //Footer with sidebar type widgets
    if (strstr(yit_get_option('footer-type'), 'sidebar')) {
        register_sidebar(yit_sidebar_args("Footer Widgets Area", __("The widget area used in Footer With Sidebar section", 'yit'), 'widget span2', apply_filters('yit_footer_widget_area_wrap', 'h3')));
        register_sidebar(yit_sidebar_args("Footer Sidebar", __("The sidebar used in Footer With Sidebar section", 'yit'), 'widget span6', apply_filters('yit_footer_widget_area_wrap', 'h3')));
    }
    //else {
    //Footer sidebars
    for ($i = 1; $i <= yit_get_option('footer-rows', 0); $i++) {
        register_sidebar(yit_sidebar_args("Footer Row {$i}", sprintf(__("The widget area #%d used in Footer section", 'yit'), $i), 'widget span' . 12 / yit_get_option('footer-columns'), apply_filters('yit_footer_sidebar_' . $i . '_wrap', 'h3')));
    }
    //}
    //remove wpml stylesheet
    define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
}
/**
 * Set up all theme data.
 *
 * @return void
 * @since 1.0.0
 */
function yit_setup_theme()
{
    /**
     * Set up the content width value based on the theme's design.
     *
     * @see yit_content_width()
     *
     * @since Twenty Fourteen 1.0
     */
    if (!isset($GLOBALS['content_width'])) {
        $GLOBALS['content_width'] = apply_filters('yit-container-width-std', 1170);
    }
    //This theme have a CSS file for the editor TinyMCE
    add_editor_style('css/editor-style.css');
    //This theme support post thumbnails
    add_theme_support('post-thumbnails');
    //This theme uses the menus
    add_theme_support('menus');
    //Add default posts and comments RSS feed links to head
    add_theme_support('automatic-feed-links');
    //This theme support post formats
    add_theme_support('post-formats', apply_filters('yit_post_formats_support', array('gallery', 'audio', 'video', 'quote')));
    if (!defined('HEADER_TEXTCOLOR')) {
        define('HEADER_TEXTCOLOR', '');
    }
    // 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', 1170));
    define('HEADER_IMAGE_HEIGHT', apply_filters('yiw_header_image_height', 410));
    // Don't support text inside the header image.
    if (!defined('NO_HEADER_TEXT')) {
        define('NO_HEADER_TEXT', true);
    }
    //This theme support custom header
    add_theme_support('custom-header');
    //This theme support custom backgrounds
    add_theme_support('custom-backgrounds');
    /*
     * Switch default core markup for search form, comment form, and comments
     * to output valid HTML5.
     */
    add_theme_support('html5', array('search-form', 'comment-form', 'comment-list'));
    // 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('blog_small' => array(368, 266, true), 'blog_single_small' => array(1140, 491, true), 'blog_masonry' => array(380, 999), 'blog_big' => array(1140, 265, true), 'blog_single_big' => array(1920, 443, true), 'blog_thumb' => array(49, 49, true), 'blog_section' => array(269, 122, true), 'blog_section_mobile' => array(716, 325, true), 'portfolio_filterable' => array(360, 392, true), 'portfolio_section' => array(380, 414, true), 'portfolio_pinterest' => 360, 'portfolio_single_big' => array(1920, 596, true), 'portfolio_single_small' => array(680, 494, true), 'portfolio_single_big_placeholder' => array(1920, 362, true), 'thumb-testimonial' => array(255, 255, true));
    $image_sizes = apply_filters('yit_add_image_size', $image_sizes);
    foreach ($image_sizes as $id_size => $size) {
        add_image_size($id_size, apply_filters('yit_' . $id_size . '_width', $size[0]), apply_filters('yit_' . $id_size . '_height', $size[1]), isset($size[2]) ? $size[2] : false);
    }
    //Set localization and load language file
    $locale = get_locale();
    $locale_file = YIT_THEME_PATH . "/languages/{$locale}.php";
    if (is_readable($locale_file)) {
        require_once $locale_file;
    }
    //remove wpml stylesheet
    define('ICL_DONT_LOAD_LANGUAGE_SELECTOR_CSS', true);
    if (!defined('WPLANG')) {
        define('WPLANG', '');
    }
    if (WPLANG != '') {
        load_theme_textdomain('yit', dirname(locate_template('/languages/' . WPLANG . '.mo')));
    } else {
        load_theme_textdomain('yit', get_template_directory() . '/languages');
    }
    // Add support to woocommerce
    if (defined('YIT_IS_SHOP') && YIT_IS_SHOP) {
        add_theme_support('woocommerce');
    }
    //Register menus
    register_nav_menus(array('nav' => __('Main Navigation', 'yit'), 'mobile-nav' => __('Mobile Navigation', 'yit'), 'welcome-menu' => __('Welcome Menu', 'yit'), 'copyright_right' => __('Copyright Right', 'yit'), 'copyright_left' => __('Copyright Left', 'yit'), 'copyright_centered' => __('Copyright Centered', 'yit')));
    //create the menu items if they don't exist
    $menuname = 'Welcome Menu';
    if (!wp_get_nav_menu_object($menuname)) {
        if (is_shop_installed()) {
            $my_account_id = get_option('woocommerce_myaccount_page_id');
            if ($my_account_id) {
                /* Assing my-account.php template to my-account page */
                update_post_meta($my_account_id, '_wp_page_template', 'my-account.php');
                $menu_id = wp_create_nav_menu($menuname);
                $my_account_url = get_permalink(wc_get_page_id('myaccount'));
                wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('My Account', 'yit'), 'menu-item-object' => 'page', 'menu-item-object-id' => get_option('woocommerce_myaccount_page_id'), 'menu-item-type' => 'post_type', 'menu-item-status' => 'publish'));
                wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('My Orders', 'yit'), 'menu-item-classes' => 'view-order', 'menu-item-url' => wc_get_endpoint_url('view-order', '', $my_account_url), 'menu-item-status' => 'publish'));
                if (!defined('YITH_WCWL')) {
                    wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('My Wishlist', 'yit'), 'menu-item-classes' => 'wishlist', 'menu-item-url' => wc_get_endpoint_url('wishlist', '', $my_account_url), 'menu-item-status' => 'publish'));
                }
                wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Edit Address', 'yit'), 'menu-item-classes' => 'edit-address', 'menu-item-url' => wc_get_endpoint_url('edit-address', '', $my_account_url), 'menu-item-status' => 'publish'));
                wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Edit Account', 'yit'), 'menu-item-classes' => 'edit-account', 'menu-item-url' => wc_get_endpoint_url('edit-account', '', $my_account_url), 'menu-item-status' => 'publish'));
                wp_update_nav_menu_item($menu_id, 0, array('menu-item-title' => __('Logout', 'yit'), 'menu-item-classes' => 'customer-logout', 'menu-item-url' => wc_get_endpoint_url('customer-logout', '', $my_account_url), 'menu-item-status' => 'publish'));
                if (!has_nav_menu('welcome-menu')) {
                    $locations = get_theme_mod('nav_menu_locations');
                    $locations['welcome-menu'] = $menu_id;
                    set_theme_mod('nav_menu_locations', $locations);
                }
            }
        }
    }
    //Register footer sidebar
    for ($i = 1; $i <= yit_get_option('footer-rows', 0); $i++) {
        register_sidebar(yit_sidebar_args("Footer Row {$i}", sprintf(__("The widget area #%d used in Footer section", 'yit'), $i), 'widget col-sm-' . 12 / yit_get_option('footer-columns'), apply_filters('yit_footer_sidebar_' . $i . '_wrap', 'h5')));
    }
}
Example #3
0
/**
 * Set up all theme data.
 *
 * @return void
 * @since 1.0.0
 */
function yit_setup_theme() {
    //Content width. WP require it. So give to WordPress what is of WordPress
    if ( ! isset( $content_width ) ) {
        $content_width = yit_get_option( 'container-width' );
    }

    //This theme have a CSS file for the editor TinyMCE
    add_editor_style( 'css/editor-style.css' );

    //This theme support 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' );

    //This theme support post formats
    add_theme_support( 'post-formats', apply_filters( 'yit_post_formats_support', array( 'gallery', 'audio', 'video', 'quote' ) ) );

    if ( ! defined( 'HEADER_TEXTCOLOR' ) ) {
        define( 'HEADER_TEXTCOLOR', '' );
    }

    // 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', 1170 ) );
    define( 'HEADER_IMAGE_HEIGHT', apply_filters( 'yiw_header_image_height', 410 ) );

    // Don't support text inside the header image.
    if ( ! defined( 'NO_HEADER_TEXT' ) ) {
        define( 'NO_HEADER_TEXT', true );
    }

    //This theme support custom header
    add_theme_support( 'custom-header' );

    //This theme support custom backgrounds
    add_theme_support( 'custom-backgrounds' );

    // 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(
        'blog_big'                         => array( 890, 0, true ),
        'blog_small'                       => array( 365, 320, true ),
        'blog_elegant'                     => array( 539, 0, true ),
        'blog_big_ribbon'                  => array( 760, 0, true ),
        'blog_small_ribbon'                => array( 370, 320, true ),
        'blog_sphera'                      => array( 280, 305, true ),
        'blog_bazar'                       => array( 858, 338, true ),
        'blog_thumb'                       => array( 75, 75, true ),
        'section_blog'                     => array( 263, 243, true ),
        'section_services'                 => array( 175, 175, true ),
        'thumb-testimonial'                => array( 41, 41, true ),
        'thumb-testimonial-circle'         => array( 100, 100, true ),
        'thumb-testimonial-quote'          => array( 87, 85, true ),
        'thumb-testimonial-square'         => array( 116, 116, true ),
        'thumb-testimonial-bazar'          => array( 62, 62, true ),
        'thumb_portfolio_fulldesc_related' => array( 258, 170, true ),
        'thumb_portfolio_bigimage'         => array( 656, 0 ),
        'thumb_portfolio_filterable'       => array( 260, 168, true ),
        'thumb_portfolio_fulldesc'         => array( 574, 340, true ),
        'thumb_portfolio_fulldesc_big'     => array( 1158, 400, true ),
        'section_video'                    => array( 162, 136, true ),
        'section_portfolio'                => array( 660, 360, true ),
        'section_portfolio_sidebar'        => array( 385, 192, true ),
        'section_portfolio_thumb'          => array( 164, 106, true ),
        'thumb_portfolio_2cols'            => array( 560, 324, true ),
        'thumb_portfolio_3cols'            => array( 360, 216, true ),
        'thumb_portfolio_4cols'            => array( 260, 172, true ),
        'accordion_thumb'                  => array( 266, 266, true ),
        'team_rounded_thumb'               => array( 130, 130, true ),
        'team_professional_thumb'          => array( 270, 270, true ),
        'team_professional_mini_thumb'     => array( 70, 70, true ),
        'featured_project_thumb'           => array( 320, 154, true ),
        'thumb_portfolio_slide'            => array( 560, 377, true ),
        'thumb_portfolio_pinterest'        => array( 260, 0 ),
        'nav_menu'                         => array( 170, 0 ),
    );

    $image_sizes = apply_filters( 'yit_add_image_size', $image_sizes );

    foreach ( $image_sizes as $id_size => $size ) {
        yit_add_image_size( $id_size, apply_filters( 'yit_' . $id_size . '_width', $size[0] ), apply_filters( 'yit_' . $id_size . '_height', $size[1] ), isset( $size[2] ) ? $size[2] : false );
    }

    //Register theme default header. Usually one
//     register_default_headers( array(
//         'theme_header' => array(
//             'url' => '%s/images/headers/001.jpg',
//             'thumbnail_url' => '%s/images/headers/thumb/001.jpg',
//             /* translators: header image description */
//             'description' => __( 'Design', 'yit' ) . ' 1'
//         )
//     ) );

    //Set localization and load language file
    $locale      = get_locale();
    $locale_file = YIT_THEME_PATH . "/languages/$locale.php";
    if ( is_readable( $locale_file ) ) {
        require_once( $locale_file );
    }

    //Register menus
    register_nav_menus(
        array(
            'nav' => __( 'Main navigation', 'yit' ),
            //'top' => __( 'Top Bar', 'yit' )
        )
    );

    //Register sidebars
    register_sidebar( yit_sidebar_args( 'Default Sidebar' ) );
    register_sidebar( yit_sidebar_args( 'Home Sidebar', 'Widget area for Home Page Template', 'home-widget span3' ) );
    register_sidebar( yit_sidebar_args( 'Blog Sidebar' ) );
    register_sidebar( yit_sidebar_args( '404 Sidebar' ) );
    register_sidebar( yit_sidebar_args( 'Header Sidebar', 'Widget area for Header', 'widget' ) );
    register_sidebar( yit_sidebar_args( 'Topbar Left', 'Left widget area for Tob Bar' ) );
    register_sidebar( yit_sidebar_args( 'Topbar Right', 'Right widget area for Tob Bar' ) );

    //User defined sidebars
    do_action( 'yit_register_sidebars' );

    //Register custom sidebars
    $sidebars = maybe_unserialize( yit_get_option( 'custom-sidebars' ) );
    if ( is_array( $sidebars ) && ! empty( $sidebars ) ) {
        foreach ( $sidebars as $sidebar ) {
            register_sidebar( yit_sidebar_args( $sidebar, '', 'widget', apply_filters( 'yit_custom_sidebar_title_wrap', 'h3' ) ) );
        }
    }

    //Footer with sidebar type widgets
    if ( strstr( yit_get_option( 'footer-type' ), 'sidebar' ) ) {
        register_sidebar( yit_sidebar_args( "Footer Widgets Area", __( "The widget area used in Footer With Sidebar section", 'yit' ), 'widget span2', apply_filters( 'yit_footer_widget_area_wrap', 'h3' ) ) );
        register_sidebar( yit_sidebar_args( "Footer Sidebar", __( "The sidebar used in Footer With Sidebar section", 'yit' ), 'widget span6', apply_filters( 'yit_footer_widget_area_wrap', 'h3' ) ) );
    } //else {
    //Footer sidebars
    for ( $i = 1; $i <= yit_get_option( 'footer-rows', 0 ); $i ++ ) {
        register_sidebar( yit_sidebar_args( "Footer Row $i", sprintf( __( "The widget area #%d used in Footer section", 'yit' ), $i ), 'widget span' . ( 12 / yit_get_option( 'footer-columns' ) ), apply_filters( 'yit_footer_sidebar_' . $i . '_wrap', 'h3' ) ) );
    }
    //}
}
Example #4
0
                    $new_url = get_permalink($vieworder->ID);
                }
                update_post_meta($item->ID, '_menu_item_url', $new_url);
                wp_update_post(array('ID' => $item->ID, 'post_title' => $vieworder->post_title));
            }
            foreach ($pages_deleted as $page) {
                if ($page && $item->object_id == $page && $item->object == 'page') {
                    wp_delete_post($item->ID);
                }
            }
        }
    }
}
/* === GENERAL SETTINGS === */
add_theme_support('woocommerce');
register_sidebar(yit_sidebar_args('Shop Sidebar'));
/* === HOOKS === */
add_action('wp_enqueue_scripts', 'yit_enqueue_woocommerce_assets');
add_action('woocommerce_before_main_content', 'yit_shop_page_meta');
add_action('shop_page_meta', 'yit_woocommerce_catalog_ordering');
add_action('shop_page_meta', 'yit_woocommerce_list_or_grid');
add_filter('loop_shop_per_page', 'yit_set_posts_per_page');
if (version_compare(preg_replace('/-beta-([0-9]+)/', '', $woocommerce->version), '2.1', '<')) {
    add_filter('woocommerce_catalog_settings', 'yit_add_featured_products_slider_image_size');
} else {
    add_filter('woocommerce_product_settings', 'yit_add_featured_products_slider_image_size');
}
add_filter('yith-wcwl-browse-wishlist-label', 'yit_change_browse_wishlist_label');
add_action('get_footer', 'yit_woocp_footer_script', 20);
add_action('yit_activated', 'yit_woocommerce_default_image_dimensions');
add_action('wp_head', 'yit_size_images_style');
/**
 * Set up all theme data.
 * 
 * @return void
 * @since 1.0.0
 */
function yit_setup_theme()
{
    //Content width. WP require it. So give to WordPress what is of WordPress
    if (!isset($content_width)) {
        $content_width = yit_get_option('container-width');
    }
    //This theme have a CSS file for the editor TinyMCE
    add_editor_style('css/editor-style.css');
    //This theme support 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');
    // 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', 1170));
    define('HEADER_IMAGE_HEIGHT', apply_filters('yiw_header_image_height', 410));
    // Don't support text inside the header image.
    if (!defined('NO_HEADER_TEXT')) {
        define('NO_HEADER_TEXT', true);
    }
    //This theme support custom header
    add_theme_support('custom-header');
    //This theme support custom backgrounds
    add_theme_support('custom-backgrounds');
    //This theme support post formats
    add_theme_support('post-formats', apply_filters('yit_post_formats_support', array('gallery', 'audio', 'video')));
    // 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('blog_big' => array(816, 282, true), 'blog_small' => array(205, 185, true), 'blog_thumb' => array(55, 55, true), 'section_blog' => array(581, 155, true), 'section_blog_sidebar' => array(386, 155, true), 'thumb-testimonial' => array(94, 94, true), 'thumb_portfolio_fulldesc_related' => array(175, 175, true), 'thumb_portfolio_bigimage' => array(770, 368, true), 'thumb_portfolio_filterable' => array(260, 168, true), 'thumb_portfolio_fulldesc' => array(700, 345, true), 'section_portfolio' => array(573, 285, true), 'section_portfolio_sidebar' => array(385, 192, true), 'thumb_portfolio_fulldesc_related' => array(175, 175, true), 'thumb_portfolio_3cols' => array(365, 192, true), 'accordion_thumb' => array(158, 176, true), 'featured_project_thumb' => array(320, 154, true));
    apply_filters('yit_add_image_size', $image_sizes);
    foreach ($image_sizes as $id_size => $size) {
        add_image_size($id_size, apply_filters('yit_' . $id_size . '_width', $size[0]), apply_filters('yit_' . $id_size . '_height', $size[1]), $size[2]);
    }
    //Set localization and load language file
    $locale = get_locale();
    $locale_file = YIT_THEME_PATH . "/languages/{$locale}.php";
    if (is_readable($locale_file)) {
        require_once $locale_file;
    }
    //Register menus
    register_nav_menus(array('nav' => __('Main navigation', 'yit')));
    //Register sidebars
    register_sidebar(yit_sidebar_args('Default Sidebar'));
    register_sidebar(yit_sidebar_args('Header Sidebar'));
    register_sidebar(yit_sidebar_args('Blog Sidebar'));
    register_sidebar(yit_sidebar_args('404 Sidebar'));
    //User definded sidebars
    do_action('yit_register_sidebars');
    //Register custom sidebars
    $sidebars = maybe_unserialize(yit_get_option('custom-sidebars'));
    if (is_array($sidebars) && !empty($sidebars)) {
        foreach ($sidebars as $sidebar) {
            register_sidebar(yit_sidebar_args($sidebar, '', 'widget', apply_filters('yit_custom_sidebar_title_wrap', 'h3')));
        }
    }
    //Footer sidebars
    for ($i = 1; $i <= yit_get_option('footer-rows', 0); $i++) {
        register_sidebar(yit_sidebar_args("Footer Row {$i}", sprintf(__("The widget area #%d used in Footer section", 'yit'), $i), 'widget', apply_filters('yit_footer_sidebar_' . $i . '_wrap', 'h3')));
    }
}