tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link https://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); // This theme uses wp_nav_menu() in four locations. register_nav_menus( array( 'secondary' => esc_html__( 'Top Bar Menu', 'ultra' ), 'top-bar-social' => esc_html__( 'Top Bar Social Menu', 'ultra' ), 'primary' => esc_html__( 'Primary Menu', 'ultra' ), 'footer' => esc_html__( 'Bottom Bar Social Menu', 'ultra' ), ) ); /* * 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', ) ); /* * Enable support for Post Formats. * See https://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', ) ); /* * Allow shortcodes to be use in category descriptions. * See https://developer.wordpress.org/reference/functions/term_description/ */ add_filter( 'term_description', 'shortcode_unautop' ); add_filter( 'term_description', 'do_shortcode' ); /* * Enable support for the custom logo. */ add_theme_support( 'custom-logo' ); /** * Support SiteOrigin Page Builder plugin. */ add_theme_support( 'siteorigin-panels', array( 'margin-sides' => 35, 'margin-bottom' => 35, 'home-page' => true, 'home-page-default' => 'default-home', 'home-demo-template' => 'home-panels.php', 'responsive' => siteorigin_setting( 'layout_responsive' ), ) ); if ( ! defined('SITEORIGIN_PANELS_VERSION') ) { // Only include panels lite if the panels plugin doesn't exist include get_template_directory() . '/inc/panels-lite/panels-lite.php'; } /** * Add the default webfonts. */ siteorigin_webfonts_add_font( 'Muli', array( 300 ) ); siteorigin_webfonts_add_font( 'Lato', array( 300, 400, 700 ) ); /** * Use the SiteOrigin archive theme settings. */ add_theme_support( 'siteorigin-template-settings' ); /** * Define the upgrade page URL. */ define( 'SITEORIGIN_THEME_PREMIUM_URL', admin_url( 'themes.php?page=premium_upgrade' ) ); } endif; // ultra_setup. add_action( 'after_setup_theme', 'ultra_setup' ); if ( ! function_exists( 'ultra_register_custom_background' ) ) : /** * Setup the WordPress core custom background feature. */ function ultra_register_custom_background() { if ( siteorigin_setting( 'layout_bound' ) == 'boxed' ) { $args = array( 'default-color' => 'eaeaea', 'default-image' => '', ); $args = apply_filters( 'ultra_custom_background_args', $args ); add_theme_support( 'custom-background', $args ); } } endif; add_action( 'after_setup_theme', 'ultra_register_custom_background' ); /** * Register widget area. * * @link https://codex.wordpress.org/Function_Reference/register_sidebar */ function ultra_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'ultra' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Visible on posts and pages that use the default template.', 'ultra' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer', 'ultra' ), 'id' => 'sidebar-2', 'description' => esc_html__( 'A column will be automatically assigned to each widget inserted.', 'ultra' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'ultra_widgets_init' ); /** * Enqueue scripts and styles. */ function ultra_scripts() { $in_footer = siteorigin_setting( 'footer_js_enqueue' ); // Theme stylesheet. wp_enqueue_style( 'ultra-style', get_stylesheet_uri(), array(), SITEORIGIN_THEME_VERSION ); // Font Awesome. wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/font-awesome/css/font-awesome.min.css', array(), '4.6.3' ); // Theme JavaScript. wp_enqueue_script( 'ultra-theme', get_template_directory_uri() . '/js/jquery.theme' . SITEORIGIN_THEME_JS_PREFIX . '.js', array( 'jquery' ), SITEORIGIN_THEME_VERSION, $in_footer ); // Sticky header. if ( siteorigin_setting( 'header_sticky' ) ) { wp_enqueue_script( 'jquery-hc-sticky', get_template_directory_uri() . '/js/jquery.hc-sticky' . SITEORIGIN_THEME_JS_PREFIX . '.js', array( 'jquery' ), '1.2.43', $in_footer ); } // Mobile menu. if ( siteorigin_setting( 'navigation_responsive_menu' ) ) { wp_enqueue_script( 'ultra-responsive-menu', get_template_directory_uri() . '/js/responsive-menu' . SITEORIGIN_THEME_JS_PREFIX . '.js', array( 'jquery' ), SITEORIGIN_THEME_VERSION, true ); } // Mobile menu collapse localisation. wp_localize_script( 'ultra-responsive-menu', 'ultra_resp_menu_params', array( 'collapse' => siteorigin_setting( 'navigation_responsive_menu_collapse' ) ) ); // Smooth scroll localisation. wp_localize_script( 'ultra-theme', 'ultra_smooth_scroll_params', array( 'value' => siteorigin_setting( 'navigation_smooth_scroll' ) ) ); // Top Bar collapse Localisation. wp_localize_script( 'ultra-theme', 'ultra_resp_top_bar_params', array( 'collapse' => siteorigin_setting( 'navigation_responsive_menu_collapse' ) ) ); // FlexSlider. wp_enqueue_script( 'jquery-flexslider' , get_template_directory_uri() . '/js/jquery.flexslider' . SITEORIGIN_THEME_JS_PREFIX . '.js', array( 'jquery' ), '2.2.2', $in_footer ); // FitVids. if ( ! class_exists( 'Jetpack' ) && siteorigin_setting( 'layout_fitvids' ) ) { wp_enqueue_script( 'jquery-fitvids' , get_template_directory_uri().'/js/jquery.fitvids' . SITEORIGIN_THEME_JS_PREFIX . '.js', array( 'jquery' ), '1.1', $in_footer ); } // Skip link focus fix. wp_enqueue_script( 'ultra-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), SITEORIGIN_THEME_VERSION, $in_footer ); // Comment reply. if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } // Flexie. wp_enqueue_script( 'ultra-flexie', get_template_directory_uri() . '/js/flexie.js', array(), '1.0.3' ); wp_script_add_data( 'ultra-flexie', 'conditional', 'lt IE 9' ); // HTML5Shiv. wp_enqueue_script( 'ultra-html5', get_template_directory_uri() . '/js/html5shiv-printshiv.js', array(), '3.7.3' ); wp_script_add_data( 'ultra-html5', 'conditional', 'lt IE 9' ); // Selectivizr. wp_enqueue_script( 'ultra-selectivizr', get_template_directory_uri() . '/js/selectivizr' . SITEORIGIN_THEME_JS_PREFIX . '.js', array(), '1.0.2' ); wp_script_add_data( 'ultra-selectivizr', 'conditional', '(gte IE 6)&(lte IE 8)' ); } add_action( 'wp_enqueue_scripts', 'ultra_scripts' ); if ( ! function_exists( 'ultra_breadcrumb' ) ): /** * Render the breadcrumb trail. */ function ultra_breadcrumb() { $breadcrumbs = ''; // JT Breadcrumb Trail. if ( function_exists( 'breadcrumb_trail' ) && siteorigin_setting( 'navigation_breadcrumb_trail' ) ) { $breadcrumbs = breadcrumb_trail( array( 'container' => 'nav', 'separator' => '/', 'show_browse' => false, 'show_on_front' => false, ) ); } // Yoast SEO. elseif ( function_exists( 'yoast_breadcrumb' ) ) { $breadcrumbs = yoast_breadcrumb( "", "", false ); } // Breadcrumb NavXT. elseif ( function_exists( 'bcn_display' ) ) { $breadcrumbs = bcn_display( true ); } if ( ! empty( $breadcrumbs ) ) { echo ''; } } endif; /** * Filter the comment form. * Remove comment form allowed tags if theme option is disabled. * * @param $defaults * @return mixed */ function ultra_comment_form_defaults( $defaults ) { if ( siteorigin_setting( 'comments_allowed_tags' ) ) { $defaults['comment_notes_after'] = '

' . sprintf( __( 'You may use these HTML tags and attributes: %s', 'ultra' ), ' ' . allowed_tags() . '' ) . '

'; } return $defaults; } add_filter( 'comment_form_defaults', 'ultra_comment_form_defaults', 5 ); if ( ! function_exists( 'ultra_custom_excerpt_length' ) ) : /** * Filter the excerpt length. */ function ultra_custom_excerpt_length( $length ) { return siteorigin_setting( 'blog_excerpt_length' ); } add_filter( 'excerpt_length', 'ultra_custom_excerpt_length', 10 ); endif; if ( ! function_exists( 'ultra_excerpt_more' ) ) : /** * Add a more link to the excerpt. */ function ultra_excerpt_more( $more ) { if ( is_search() ) return; if ( siteorigin_setting( 'blog_archive_content' ) == 'excerpt' && siteorigin_setting( 'blog_excerpt_more' ) ) { $read_more_text = siteorigin_setting( 'blog_read_more' ) ? esc_html( siteorigin_setting( 'blog_read_more' ) ) : esc_html__( 'Continue reading', 'ultra' ); return '

' . $read_more_text . '

'; } } endif; add_filter( 'excerpt_more', 'ultra_excerpt_more' ); /** * Count the footer widgets and add the count to the widget class. */ function ultra_footer_widgets_params( $params ) { $sidebar_id = $params[0]['id']; if ( $sidebar_id == 'sidebar-2' ) { $total_widgets = wp_get_sidebars_widgets(); $sidebar_widgets = count($total_widgets[$sidebar_id]); $params[0]['before_widget'] = str_replace('class="', 'class="widget-count-' . floor( $sidebar_widgets ) . ' ', $params[0]['before_widget']); } return $params; } add_filter( 'dynamic_sidebar_params','ultra_footer_widgets_params' ); /** * Filter the header opacity setting. */ function ultra_filter_header_opacity() { return siteorigin_setting( 'header_opacity' ); } add_filter( 'ultra_sticky_header_opacity', 'ultra_filter_header_opacity' ); /** * Add the header opacity CSS. */ function ultra_set_header_opacity() { if ( siteorigin_setting( 'header_opacity' ) == '1' ) return; $header_opacity_theme_setting = siteorigin_setting( 'header_opacity' ); $header_background_color = get_theme_mod( 'ultra_header_background_color', '#ffffff' ); if ( $header_opacity_theme_setting != 1 && $header_background_color == '#ffffff' ) { $header_sticky_opacity = apply_filters( 'ultra_sticky_header_opacity', 1 ); ?>
>
' . $read_more_text . ''; } add_filter( 'the_content_more_link', 'ultra_read_more_link' ); endif; /** * Add the responsive menu button. */ function ultra_responsive_menu() { if ( siteorigin_setting( 'navigation_responsive_menu' ) ) { echo ''; } } add_action( 'ultra_before_nav', 'ultra_responsive_menu' ); /** * Filter the responsive menu collapse. */ function ultra_filter_responsive_menu_collapse( $collpase ) { return siteorigin_setting( 'navigation_responsive_menu_collapse' ); } add_filter( 'ultra_responsive_menu_resolution', 'ultra_filter_responsive_menu_collapse' ); if ( ! function_exists( 'ultra_responsive_menu_css' ) ): /** * Output the responsive menu collpase point. */ function ultra_responsive_menu_css() { if ( ! siteorigin_setting( 'navigation_responsive_menu' ) || ! siteorigin_setting( 'layout_responsive' ) ) return; $mobile_resolution = apply_filters( 'ultra_responsive_menu_resolution', 1024 ); ?> ' . get_bloginfo( 'name' ) . ''; return str_replace( array( '{site-title}', '{copyright}', '{year}' ), array( $site_title, '©', date('Y') ), $copyright ); } add_filter( 'ultra_copyright_text', 'ultra_footer_copyright_text_sub' ); if ( ! function_exists( 'ultra_top_bar_text_area' ) ): /** * Display the top bar text. */ function ultra_top_bar_text_area() { $phone = wp_kses_post( siteorigin_setting( 'text_phone' ) ); $email = wp_kses_post( siteorigin_setting( 'text_email' ) ); if ( siteorigin_setting( 'text_phone' ) ) { echo '' . $phone . ''; } if ( siteorigin_setting( 'text_email' ) ) { echo '' . $email . ''; } } add_action( 'ultra_top_bar_text', 'ultra_top_bar_text_area' ); endif; if ( ! function_exists( 'ultra_is_woocommerce_active' ) ) : /** * Check that WooCommerce is active. * * @return bool */ function ultra_is_woocommerce_active() { return in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ); } endif; /* IMPORTANT NOTICE: Please don't edit this file; any changes made here will be lost during the theme update process. If you need to add custom functions, use the Code Snippets plugin (https://wordpress.org/plugins/code-snippets/) or a child theme. */