/**
* Coeus functions and definitions
*
* @link https://developer.wordpress.org/themes/basics/theme-functions/
*
* @package WordPress
* @subpackage coeus
* @since 1.0
*/
/**
* 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 for post thumbnails.
*/
function coeus_setup() {
/*
* Make theme available for translation.
* Translations can be filed in the /languages/ directory.
* If you're building a theme based on cubic, use a find and replace
* to change 'cubic' to the name of your theme in all the template files
*/
load_theme_textdomain( 'coeus', get_template_directory() . '/languages' );
// Add default posts and comments RSS feed links to head.
add_theme_support( 'automatic-feed-links' );
/*
* Let WordPress manage the document title.
* By adding theme support, we declare that this theme does not use a
* hard-coded
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( 'custom-header' );
add_theme_support( 'custom-background' );
add_theme_support( 'post-thumbnails' );
// Set the default content width.
$GLOBALS['content_width'] = 525;
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'primary' => esc_html__( 'Main Menu', 'coeus' ),
'onepage' => esc_html__( 'Onepage Menu', 'coeus' ),
) );
/*
* 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.
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'image',
'video',
'gallery',
'audio',
) );
/*
* 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', coeus_fonts_url() ) );
}
add_action( 'after_setup_theme', 'coeus_setup' );
/**
* Register custom fonts.
*/
if ( ! function_exists( 'coeus_fonts_url' ) ) :
/**
* Register Google fonts for Coeus.
*
* Create your own coeus_fonts_url() function to override in a child theme.
*
* @since Coeus 1.0
*
* @return string Google fonts URL for the theme.
*/
function coeus_fonts_url() {
$fonts_url = '';
$font_families = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Work Sans, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Work+Sans: on or off', 'coeus' ) ) {
$font_families[] = 'Work Sans:100,200,300,400,500,600,700,800,900';
}
/* translators: If there are characters in your language that are not supported by Poppins, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Poppins: on or off', 'coeus' ) ) {
$font_families[] = 'Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i';
}
/* translators: If there are characters in your language that are not supported by Crimson+Text, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Crimson+Text: on or off', 'coeus' ) ) {
$font_families[] = 'Crimson Text:400,400i,600,600i,700,700i';
}
if ( $font_families ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
endif;
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function coeus_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Primary Sidebar', 'coeus' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here to appear in your sidebar on blog posts and archive pages.', 'coeus' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer First Widget Area', 'coeus' ),
'id' => 'footer-area-1',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'coeus' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Second Widget Area', 'coeus' ),
'id' => 'footer-area-2',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'coeus' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Third Widget Area', 'coeus' ),
'id' => 'footer-area-3',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'coeus' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Fourth Widget Area', 'coeus' ),
'id' => 'footer-area-4',
'description' => esc_html__( 'Add widgets here to appear in your footer.', 'coeus' ),
'before_widget' => '