esc_html__( 'Currency Switcher', 'alpus' ), 'lang-switcher' => esc_html__( 'Language Switcher', 'alpus' ), 'main-menu' => esc_html__( 'Main Menu', 'alpus' ), ) ) ); // support WordPress add_theme_support( 'title-tag' ); add_theme_support( 'custom-background', array() ); add_theme_support( 'custom-header', array() ); add_theme_support( 'custom-logo', array() ); // support gutenberg add_theme_support( 'wp-block-styles' ); add_theme_support( 'responsive-embeds' ); add_theme_support( 'align-wide' ); add_theme_support( 'editor-styles' ); // support woocommerce add_theme_support( 'woocommerce' ); add_theme_support( 'wc-product-gallery-lightbox' ); // default rss feed links add_theme_support( 'automatic-feed-links' ); // add support for post thumbnails add_theme_support( 'post-thumbnails' ); // add support for post formats add_theme_support( 'post-formats', array( 'video' ) ); // 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', 'gallery', 'caption', 'script', 'style', ) ); // add editor custom font sizes add_theme_support( 'editor-font-sizes', array( array( 'name' => esc_html__( 'Small', 'alpus' ), 'shortName' => esc_html__( 'S', 'alpus' ), 'size' => 15, 'slug' => 'small', ), array( 'name' => esc_html__( 'Normal', 'alpus' ), 'shortName' => esc_html__( 'N', 'alpus' ), 'size' => 18, 'slug' => 'normal', ), array( 'name' => esc_html__( 'Medium', 'alpus' ), 'shortName' => esc_html__( 'M', 'alpus' ), 'size' => 24, 'slug' => 'medium', ), array( 'name' => esc_html__( 'Large', 'alpus' ), 'shortName' => esc_html__( 'L', 'alpus' ), 'size' => 30, 'slug' => 'large', ), array( 'name' => esc_html__( 'Huge', 'alpus' ), 'shortName' => esc_html__( 'huge', 'alpus' ), 'size' => 34, 'slug' => 'huge', ), ) ); // editor color palette add_theme_support( 'editor-color-palette', array( array( 'name' => esc_html__( 'Primary', 'alpus' ), 'slug' => 'primary', 'color' => alpha_get_option( 'primary_color' ), ), array( 'name' => esc_html__( 'Secondary', 'alpus' ), 'slug' => 'secondary', 'color' => alpha_get_option( 'secondary_color' ), ), array( 'name' => esc_html__( 'Alert', 'alpus' ), 'slug' => 'alert', 'color' => alpha_get_option( 'alert_color' ), ), array( 'name' => esc_html__( 'Dark', 'alpus' ), 'slug' => 'dark', 'color' => '#333', ), array( 'name' => esc_html__( 'White', 'alpus' ), 'slug' => 'white', 'color' => '#fff', ), array( 'name' => esc_html__( 'Default Font Color', 'alpus' ), 'slug' => 'font', 'color' => '#666', ), array( 'name' => esc_html__( 'Transparent', 'alpus' ), 'slug' => 'transparent', 'color' => 'transparent', ), ) ); add_editor_style(); /** * Filters the image sizes. * * @since 1.0 */ $image_sizes = apply_filters( 'alpha_image_sizes', array( 'alpha-post-medium' => array( 'width' => 600, 'height' => 420, 'crop' => true, ), 'alpha-post-small' => array( 'width' => 400, 'height' => 280, 'crop' => true, ), 'alpha-product-thumbnail' => array( 'width' => 150, 'height' => 0, 'crop' => true, ), ) ); $sizes = alpha_get_option( 'custom_image_sizes' ); if ( is_array( $sizes ) ) { $old_size = alpha_get_option( 'custom_image_size' ); if ( ! empty( $old_size['Width'] ) && ! empty( $old_size['Height'] ) ) { $sizes[] = array( 'size_name' => esc_html__( 'Alpha Custom', 'alpus' ), 'width' => $old_size['Width'], 'height' => $old_size['Height'], ); set_theme_mod( 'custom_image_sizes', $sizes ); remove_theme_mod( 'custom_image_size' ); } foreach ( $sizes as $size ) { if ( ! empty( $size['size_name'] ) && ! empty( $size['width'] ) && ! empty( $size['height'] ) ) { $image_sizes[ $size['size_name'] ] = array( 'width' => (int) $size['width'], 'height' => (int) $size['height'], 'crop' => true, ); } } } foreach ( $image_sizes as $image => $size ) { add_image_size( $image, $size['width'], $size['height'], $size['crop'] ); } // Content Width if ( ! isset( $content_width ) ) { $content_width = 1240; } } /** * Add Widget Areas ( Sidebar ) * * @since 1.0 * @access public */ public function setup_sidebars() { $sidebars = array(); $sidebars['blog-sidebar'] = array( 'name' => esc_html__( 'Blog Sidebar', 'alpus' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ); // @start feature: fs_plugin_woocommerce if ( class_exists( 'WooCommerce' ) ) { $sidebars['shop-sidebar'] = array( 'name' => esc_html__( 'Shop Sidebar', 'alpus' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ); $sidebars['product-sidebar'] = array( 'name' => esc_html__( 'Product Sidebar', 'alpus' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ); } // @end feature: fs_plugin_woocommerce /** * Filters the sidebars. * * @param array $sidebars The sidebar array. * @since 1.0 */ $sidebars = apply_filters( 'alpha_sidebars', $sidebars ); foreach ( $sidebars as $id => $sidebar ) { $sidebar['id'] = $id; register_sidebar( $sidebar ); } // Extra sidebars $extra_sidebars = json_decode( get_option( 'alpha_sidebars', '[]' ), true ); if ( $extra_sidebars ) { foreach ( $extra_sidebars as $slug => $name ) { register_sidebar( array( 'name' => sprintf( '%s', $name ), 'id' => $slug, 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } } } /** * Add info to admin bar about maintenance notice * * @since 1.3.0 */ public function add_maintenance_notice( $admin_bar ) { if ( ! empty( alpha_get_option( 'is_maintenance' ) ) ) { $admin_bar->add_menu( array( 'id' => 'alpha-maintenance', 'parent' => 'top-secondary', 'title' => sprintf( __( '%1$sMaintenance Mode Enabled%2$s', 'alpus' ), '', '' ), 'href' => '#', ) ); } return $admin_bar; } /** * Control the maintenance mode * * @since 1.3.0 */ public function control_maintenance( $template ) { if ( is_user_logged_in() && current_user_can( 'edit_published_posts' ) ) { return $template; } if ( empty( alpha_get_option( 'is_maintenance' ) ) ) { return $template; } $abspath = str_replace( array( '\\', '/' ), DIRECTORY_SEPARATOR, ABSPATH ); $included_files = get_included_files(); if ( in_array( $abspath . 'wp-login.php', $included_files ) || in_array( $abspath . 'wp-register.php', $included_files ) || ( isset( $_GLOBALS['pagenow'] ) && $GLOBALS['pagenow'] == 'wp-login.php' ) || $_SERVER['PHP_SELF'] == '/wp-login.php' ) { return $template; } $fallback = '

'; $fallback .= esc_html__( 'This is default maintenance page. Please create a new page and set it as \'Maintenance Page\' in Theme Option.', 'alpus' ); $fallback .= '

'; $maintenance_page = alpha_get_option( 'maintenance_page' ); if ( $maintenance_page ) { if ( is_page( $maintenance_page ) ) { status_header( 503 ); // Common causes are a server that is down for maintenance or that is overloaded. nocache_headers(); return $template; } if ( wp_redirect( get_permalink( $maintenance_page ) ) ) { exit; } } /** * Output a fallback message if redirect failed or no page selected */ status_header( 503 ); nocache_headers(); exit( $fallback ); } } new Alpha_Support;