>>> DO NOT EDIT THIS FILE <<<< * * Warning! DO NOT EDIT THIS FILE, or any other theme file! If you edit ANY theme * file, all your changes will be LOST when you update the theme to a newer version. * Instead, if you need to change theme functionality, CREATE A CHILD THEME! * * >>>> DO NOT EDIT THIS FILE <<<< * * Sets up the theme and provides some helper functions. Some helper functions * are used in the theme as custom template tags. * * The first function, absolute_weaver_setup(), sets up the theme by registering support * for various features in WordPress, such as post thumbnails, navigation menus, and the like. * * This file formatted 4/8 on tabs * * >>>> DO NOT EDIT THIS FILE <<<< */ add_action( 'after_setup_theme', 'absolute_weaver_setup' ); // run absolute_weaver_setup() when the 'after_setup_theme' hook is run if ( ! function_exists( 'absolute_weaver_setup' ) ) : /** * Sets up theme defaults and registers support for various WordPress features. * * Note that this function is hooked into the after_setup_theme hook, which runs * before the init hook. The init hook is too late for some features, such as indicating * support post thumbnails. * * To override absolute_weaver_setup() in a child theme, add your own absolute_weaver_setup to your child theme's * functions.php file. * * @uses load_theme_textdomain() For translation/localization support. * @uses add_editor_style() To style the visual editor. * @uses add_theme_support() To add support for post thumbnails, automatic feed links, and Post Formats. * @uses register_nav_menus() To add support for navigation menus. * @uses register_default_headers() To register the default custom header images provided with the theme. * @uses set_post_thumbnail_size() To set a custom post thumbnail size * @uses add_theme_support( 'custom-header', $absolute_weaver_header ) for WP 3.4+ custom header * * */ function absolute_weaver_setup() { if ( ! isset( $GLOBALS['content_width'] ) ) { $GLOBALS['content_width'] = ( int ) ( ABSOLUTE_WEAVER_THEME_WIDTH * .75 ); } /* * Make theme available for translation. * Translations can be filed in the /languages/ directory. */ load_theme_textdomain( 'absolute-weaver', get_template_directory() . '/languages' ); // now theme's translations as fallback // ******** add theme support possibilities ******** // Add default posts and comments RSS feed links to head. add_theme_support( 'automatic-feed-links' ); // Let WordPress manage the document title. add_theme_support( 'title-tag' ); // Enable support for Post Thumbnails on posts and pages. add_theme_support( 'post-thumbnails' ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); // html5 for search // future: comment-form, comment-list, gallery, caption add_theme_support( 'html5', array( 'search-form' ) ); // Add support for responsive embedded content. add_theme_support( 'responsive-embeds' ); // gutenberg // Add support for a variety of post formats ( not supported: chat ) - NOT Absolute Weaver // now, need Absolute Weaver settings available for everything else absolute_weaver_init_opts( 'functions' ); // Now add all the support needed for the editor - both classic and block editor // Absolute Weaver provides its own block styles, so we don't want to include // add_theme_support( 'wp-block-styles' ); // because it pulls in wp-includes/css/dist/block-library/theme.min.css // Add support for default block styles. add_theme_support( 'wp-block-styles' ); // Add support for full and wide align images. add_theme_support( 'align-wide' ); // Add support for editor styles. add_theme_support( 'editor-styles' ); if ( absolute_weaver_getopt( '_hide_editor_style' ) ) { // Enqueue editor styles - without theme editor styles add_editor_style( array( 'editor-style.css', // classic editor 'assets/css/blocks-editor-base-style' . ABSOLUTE_WEAVER_MINIFY . '.css', // gutenberg ABSOLUTE_WEAVER_GOOGLE_FONTS_URL, ) ); // from settings.php - in %7C format } else { absolute_weaver_check_editor_style(); // see if we need an update... $vers = absolute_weaver_getopt( 'style_version' ); if ( ! $vers ) { $vers = '1'; } else { $vers = sprintf( "%d", $vers ); } $updir = wp_upload_dir( null, true, true ); // force cache update to avoid bug after moving hosts $css_path = trailingslashit( $updir['baseurl'] ) . 'absolute-weaver-css/editor-early-style-awvr.css?vers=' . $vers; // Enqueue editor styles - without theme editor styles add_editor_style( array( 'editor-style.css', // classic editor 'assets/css/blocks-editor-base-style' . ABSOLUTE_WEAVER_MINIFY . '.css', // gutenberg $css_path, ABSOLUTE_WEAVER_GOOGLE_FONTS_URL, ) ); } absolute_weaver_dark_theme_check(); // add Block Editor dark theme support if theme settings have dark bg $width = absolute_weaver_getopt_default( 'theme_width_int', ABSOLUTE_WEAVER_THEME_WIDTH ); $height = absolute_weaver_getopt_default( 'header_image_height_int', 188 ); // now that everything is responsive, we can just set this to an arbitrary height. // Enable support for custom logo. add_theme_support( 'custom-logo', array( 'height' => $height, 'width' => $width, 'flex-height' => true, ) ); $absolute_weaver_header_args = array( 'default-image' => '%s/assets/images/headers/Maroon-Bells.jpg', 'random-default' => true, 'width' => $width, 'height' => $height, 'flex-height' => true, 'flex-width' => true, 'default-text-color' => '', 'header-text' => false, 'uploads' => true, 'video' => false, 'wp-head-callback' => '', 'admin-head-callback' => 'absolute_weaver_admin_header_style', 'admin-preview-callback' => '', ); $GLOBALS['content_width'] = $width; // let the WP $content_width be the same as theme width, and let our responsive CSS make it work. add_theme_support( 'custom-header', $absolute_weaver_header_args ); add_theme_support( 'custom-background' ); // Report all errors except E_NOTICE error_reporting( E_ALL & ~E_WARNING ); // We'll be using post thumbnails for custom header images on posts and pages. // We want them to be the size of the header image that we just defined // Larger images will be auto-cropped to fit, smaller ones will be ignored. See header.php. absolute_weaver_register_header_images(); // Absolute Weaver supports two main nav menus register_nav_menus( array( 'primary' => esc_html__( 'Primary Navigation: if specified, used instead of Default menu', 'absolute-weaver' ), 'header-mini' => esc_html__( 'Header Mini Menu: if specified, adds horizontal mini-menu to header', 'absolute-weaver'), ) ); } endif; // absolute_weaver_setup //-- if ( ! function_exists( 'absolute_weaver_init_opts' ) ) : function absolute_weaver_init_opts( $who = '' ) { // this sets either the current settings, or the default values. absolute_weaver_clear_opt_cache( 'absolute_weaver_init_opts' ); // start with a clear cache $themename = absolute_weaver_getopt( 'themename' ); // load the theme from the db if there ( absolute_weaver_getopt loads the options if there ) if ( $themename === false ) { require_once( get_template_directory() . '/inc/get-default-settings.php' ); // load a set of defaults ( Not a template file ) absolute_weaver_get_default_settings(); } if ( ABSOLUTE_WEAVER_SMARTMENUS_DEFAULT ) absolute_weaver_setopt( 'use_smartmenus', true ); } endif; //-- if ( ! function_exists( 'absolute_weaver_dark_theme_check' ) ) : function absolute_weaver_dark_theme_check() { $bg = ''; if ( ( $val = absolute_weaver_getopt_default( 'editor_bgcolor', 'inherit' ) ) && $val != 'inherit' ) { /* alt bg color */ $bg = $val; } elseif ( ( $val = absolute_weaver_getopt_default( 'content_bgcolor', 'inherit' ) ) && $val != 'inherit' ) { /* #content */ $bg = $val; } elseif ( ( $val = absolute_weaver_getopt_default( 'container_bgcolor', 'inherit' ) ) && $val != 'inherit' ) { /* #container */ $bg = $val; } elseif ( ( $val = absolute_weaver_getopt_default( 'wrapper_bgcolor', 'inherit' ) ) && $val != 'inherit' ) { /* #wrapper */ $bg = $val; } elseif ( ( $val = absolute_weaver_getopt_default( 'body_bgcolor', 'inherit' ) ) && $val != 'inherit' ) { /* Outside BG */ $bg = $val; } elseif ( ( $name = absolute_weaver_getopt( 'themename' ) ) && strpos( $name, 'Transparent Dark' ) !== false ) { // fix in V3.0.5 $bg = '#222'; } // now decide if we need to add alternate styling for the editor icons $need_alt = $bg && $bg[0] != '#'; // always use alt styling for non-hex bg colors if ( ! $need_alt ) { // Normalize a proper hex string with length 6 = but assume started as a #hex $hex = preg_replace( "/[^0123456789abcdef]/", '', strtolower( $bg ) ); if ( strlen( $hex ) == 3 ) { $hex = preg_replace( "/(.)(.)(.)/", '\1\1\2\2\3\3', $hex ); } if ( preg_match( '/^[0123456789abcdef]{6}$/', $hex ) ) { // have a valid hex string if ( hexdec( $hex ) < hexdec( '888888' ) ) // hex values less than #888888 are "dark" { $need_alt = true; } } } if ( $need_alt ) { add_theme_support( 'dark-editor-style' ); } } endif; // dark theme check //-- /** */ if ( ! function_exists( 'absolute_weaver_register_header_images' ) ) : function absolute_weaver_register_header_images() { // Default custom headers packaged with the theme. %s is a placeholder for the theme template directory URI. register_default_headers( array( 'maroon-bells' => array( 'url' => '%s/assets/images/headers/Maroon-Bells.jpg', 'thumbnail_url' => '%s/assets/images/headers/Maroon-Bells-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Maroon Bells', 'absolute-weaver' ), ), 'beckwith-mtn' => array( 'url' => '%s/assets/images/headers/beckwith-mtn.jpg', 'thumbnail_url' => '%s/assets/images/headers/beckwith-mtn-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Colorado Autumn', 'absolute-weaver' ), ), 'arctic-aurora' => array( 'url' => '%s/assets/images/headers/grand-mesa.jpg', 'thumbnail_url' => '%s/assets/images/headers/grand-mesa-thumbnail.jpg', /* translators: header image description */ 'description' => esc_html__( 'Grand Mesa', 'absolute-weaver' ), ), ) ); } endif; //-- if ( ! function_exists( 'absolute_weaver_admin_header_style' ) ) { /** * Styles the header image displayed on the Appearance > Header admin panel. */ function absolute_weaver_admin_header_style() { ?> $name, 'id' => $id, 'description' => $desc, 'before_widget' => '', 'before_title' => '