'sidebar_r', 'calibration_show_menu' => true, 'calibration_front_layout' => '', 'calibration_show_front_title' => true, 'calibration_apply_post_format' => true, 'calibration_show_post_as' => 'post_content', 'calibration_hide_default_category' => false, 'calibration_footer_title' => '' . get_bloginfo( 'name', 'display' ) . '', 'calibration_footer_entry' => sprintf( /* translators: %1$s: linked name of the theme, %2$s: linked name of the theme author */ esc_html__( 'WordPress theme %1$s by %2$s', 'calibration' ), 'Calibration', 'mobileMarkup.com' ), 'calibration_show_privacy_policy' => true, ); /** * Filter theme default settings. * * @since 1.0.0 * * @param array Theme default settings keys and values */ $defaults = apply_filters( 'calibration_theme_defaults', $defaults ); return $defaults; } endif; if ( ! function_exists( 'calibration_get_theme_mods' ) ) : /** * Merge theme mods saved in database with theme defaults * * @since 1.0.0 * * @return array Current theme modifications merged with default settings */ function calibration_get_theme_mods() { return wp_parse_args( get_theme_mods(), calibration_get_theme_defaults() ); } endif; if ( ! function_exists( 'calibration_get_theme_mod' ) ) : /** * Get a specific theme mod value * * @since 1.0.0 * * @param string $name Theme mod name * @return mixed Theme mod value - stored in database or default or null */ function calibration_get_theme_mod( $name ) { $defaults = calibration_get_theme_defaults(); if ( ! isset( $defaults[$name] ) ) : return null; endif; $mod = get_theme_mod( $name, $defaults[$name] ); return $mod; } endif; if ( ! function_exists( 'calibration_setup' ) ) : add_action( 'after_setup_theme', 'calibration_setup' ); /** * Set up theme defaults and registers support for various WordPress features. * * Action hook: 'after_setup_theme' * * @since 1.0.0 */ function calibration_setup() { /* * Make theme available for translation. */ load_theme_textdomain( 'calibration', CALIB_LANG_DIR ); /* * 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' ); set_post_thumbnail_size( 300, 300 ); /* * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'top' => __( 'Top Menu', 'calibration' ) ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'comment-form', 'comment-list', 'gallery', 'caption', ) ); /* * Enable support for Post Formats. */ add_theme_support( 'post-formats', array( 'gallery', ) ); /* * Set up the WordPress core custom background feature. */ add_theme_support( 'custom-background', apply_filters( 'calibration_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', 'default-repeat' => 'no-repeat', 'default-position-x' => 'center', 'default-position-y' => 'center', 'default-size' => 'cover', 'default-attachment' => 'fixed', 'wp-head-callback' => '_custom_background_cb', ) ) ); /* * Add theme support for selective refresh for widgets. */ add_theme_support( 'customize-selective-refresh-widgets' ); /* * Add support for core custom logo. */ add_theme_support( 'custom-logo', apply_filters( 'calibration_custom_logo_args', array( 'height' => 125, 'width' => 250, 'flex-width' => true, 'flex-height' => true, 'header-text' => array( 'logo', 'tagline' ), ) ) ); } endif; // END of setup theme add_action( 'after_setup_theme', 'calibration_content_width', 0 ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Action hook: 'after_setup_theme' * * @since 1.0.0 * * @global int $content_width */ function calibration_content_width() { $GLOBALS['content_width'] = apply_filters( 'calibration_content_width', 1920 ); } add_action( 'widgets_init', 'calibration_widgets_init' ); /** * Register widget areas. * * Action hook: 'widgets_init' * * @since 1.0.0 */ function calibration_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'calibration' ), 'id' => 'sidebar-1', 'description' => __( 'Add widgets here to appear in your sidebar.', 'calibration' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } add_filter( 'language_attributes', 'calibration_document_attributes' ); /** * Adds custom attributes to document root * * Filter hook: 'language_attributes' * * @since 1.0.0 * * @param string $output Attributes applied to tag */ function calibration_document_attributes( $output ) { return "$output itemscope itemtype=\"http://schema.org/WebPage\""; } add_filter( 'body_class', 'calibration_body_classes' ); /** * Adds custom classes to the array of body classes. * * Filter hook: 'body_class' * * @since 1.0.0 * * @param array $classes Classes for the body element. */ function calibration_body_classes( $classes ) { if ( calibration_is_front() ) : $classes[] = 'front'; endif; if ( calibration_has_header_image() ) : $classes[] = 'has-header-image'; endif; if ( is_active_sidebar( 'sidebar-1' ) && ! is_page_template( 'templates/no-sidebar.php' ) && ! is_404() ) : $classes[] = 'has-sidebar'; if ( calibration_is_empty_search() ) : $classes[] = 'has-sidebar-below'; else : $calibration_theme_mods = calibration_get_theme_mods(); $layout_type = ( calibration_is_front() && '' != $calibration_theme_mods['calibration_front_layout'] ? $calibration_theme_mods['calibration_front_layout'] : $calibration_theme_mods['calibration_site_layout'] ); switch ( $layout_type ) : case 'sidebar_l': $classes[] = 'has-sidebar-before'; break; case 'sidebar_b': $classes[] = 'has-sidebar-below'; break; default: $classes[] = 'has-sidebar-after'; break; endswitch; endif; endif; return $classes; } add_filter( 'wp_page_menu', 'calibration_standarize_menu', 10, 2 ); /** * Remove div wrapper from page menu and assign the class to the list instead * * Filter hook: 'wp_page_menu' * * @since 1.0.0 * * @param string $html Output of wp_page_menu() */ function calibration_standarize_menu( $html, $args ) { if ( ! array_key_exists( 'theme_location', $args ) || 'top' != $args['theme_location'] ) : return $html; endif; preg_match( '/^
/i', $html, $matches ); $divclass = $matches[1]; $to_replace = array( '
', '
' ); $html = str_replace( $to_replace, '', $html ); $html = preg_replace( '/^