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://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/ */ add_theme_support( 'post-thumbnails' ); add_image_size( 'moral-home-blog', 400, 300, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Primary', 'emerge' ), 'social' => esc_html__( 'Social', 'emerge' ), ) ); /* * 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', ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'moral_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', ) ) ); // Add theme support for selective refresh for widgets. add_theme_support( 'customize-selective-refresh-widgets' ); /** * Add support for core custom logo. * * @link https://codex.wordpress.org/Theme_Logo */ add_theme_support( 'custom-logo', array( 'height' => 250, 'width' => 250, 'flex-width' => true, 'flex-height' => true, ) ); /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, and column width. */ add_editor_style( array( 'assets/css/editor-style.css', moral_fonts_url() ) ); } endif; add_action( 'after_setup_theme', 'moral_setup' ); /** * Set the content width in pixels, based on the theme's design and stylesheet. * * Priority 0 to make it available to lower priority callbacks. * * @global int $content_width */ function moral_content_width() { $GLOBALS['content_width'] = apply_filters( 'moral_content_width', 900 ); } add_action( 'after_setup_theme', 'moral_content_width', 0 ); /** * Register widget area. * * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar */ function moral_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Primary Sidebar', 'emerge' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'emerge' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); for ( $i=1; $i <= 3; $i++ ) { register_sidebar( array( 'name' => esc_html__( 'Footer Widget Area ', 'emerge' ) . $i, 'id' => 'footer-' . $i, 'description' => esc_html__( 'Add widgets here.', 'emerge' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); } } add_action( 'widgets_init', 'moral_widgets_init' ); /** * Register custom fonts. */ function moral_fonts_url() { $fonts_url = ''; $font_families = array(); /* * Translators: If there are characters in your language that are not * supported by Pacifico, translate this to 'off'. Do not translate * into your own language. */ $pacifico = _x( 'on', 'Pacifico font: on or off', 'emerge' ); if ( 'off' !== $pacifico ) { $font_families[] = 'Pacifico'; } $oxygen = _x( 'on', 'Oxygen font: on or off', 'emerge' ); if ( 'off' !== $oxygen ) { $font_families[] = 'Oxygen:300,400,700'; } $raleway = _x( 'on', 'Raleway font: on or off', 'emerge' ); if ( 'off' !== $raleway ) { $font_families[] = 'Raleway:300,400,500,600,700'; } $query_args = array( 'family' => urlencode( implode( '|', $font_families ) ), 'subset' => urlencode( 'latin,latin-ext' ), ); $fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' ); return esc_url_raw( $fonts_url ); } /** * Enqueue scripts and styles. */ function moral_scripts() { // Add custom fonts, used in the main stylesheet. wp_enqueue_style( 'moral-fonts', moral_fonts_url(), array(), null ); wp_enqueue_style( 'moral-style', get_stylesheet_uri() ); wp_enqueue_script( 'packery-pkgd', get_theme_file_uri( '/assets/js/packery.pkgd.js' ), array( 'jquery' ), '20151215', true ); wp_enqueue_script( 'moral-navigation', get_theme_file_uri( '/assets/js/navigation.js' ), array(), '20151215', true ); wp_enqueue_script( 'moral-skip-link-focus-fix', get_theme_file_uri() . '/assets/js/skip-link-focus-fix.js', array(), '20151215', true ); wp_enqueue_script( 'moral-custom', get_theme_file_uri( '/assets/js/custom.js' ), array(), '20151215', true ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } } add_action( 'wp_enqueue_scripts', 'moral_scripts' ); /** * Custom template tags for this theme. */ require get_parent_theme_file_path( '/inc/template-tags.php' ); /** * Functions which enhance the theme by hooking into WordPress. */ require get_parent_theme_file_path( '/inc/template-functions.php' ); /** * Customizer additions. */ require get_parent_theme_file_path( '/inc/customizer.php' ); /** * SVG icons functions and filters. */ require get_parent_theme_file_path( '/inc/icon-functions.php' ); /** * Admin welcome page */ require get_parent_theme_file_path( '/inc/welcome.php' ); /** * TGMPA call */ require get_parent_theme_file_path( '/inc/tgmpa/call.php' ); /** * OCDI compatibility. */ if ( class_exists( 'OCDI_Plugin' ) ) { require get_parent_theme_file_path( '/inc/ocdi.php' ); } /** * Redirect page to About Emerge page on theme activation */ global $pagenow; if ( is_admin() && 'themes.php' == $pagenow && isset( $_GET['activated'] ) ) { wp_redirect( admin_url( 'themes.php?page=moral-welcome' ) ); } /** * Enqueue admin css. * @return [type] [description] */ function moral_load_custom_wp_admin_style() { wp_register_style( 'moral-admin', get_theme_file_uri( 'assets/css/moral-admin.css' ), false, '1.0.0' ); wp_enqueue_style( 'moral-admin' ); } add_action( 'admin_enqueue_scripts', 'moral_load_custom_wp_admin_style' ); /** * Styles the header image and text displayed on the blog. * * @see moral_custom_header_setup(). */ function moral_header_text_style() { // If we get this far, we have custom styles. Let's do this. $header_text_display = get_theme_mod( 'moral_header_text_display', true ); ?>