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', array( 'post', 'page' ) );
/**
* Add image size for the theme style.
*/
//add_image_size( 'apollohotel-slideshow', 1920, 1080, true );
add_image_size( 'apollohotel-slideshow', 1800, 800, true );
add_image_size( 'apollohotel-slideshow-lg', 1400, 600, true );
add_image_size( 'apollohotel-slideshow-md', 800, 600, true );
add_image_size( 'apollohotel-slideshow-sm', 600, 600, true );
add_image_size( 'apollohotel-featured-page', 800, 400, true );
add_image_size( 'apollohotel-thumbnail', 600, 420, true );
// This theme uses wp_nav_menu() in two locations.
register_nav_menus( array(
'primary' => __( 'Main Menu', 'apollohotel' )
) );
/**
* 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',
) );
/**
* Add support for Custom Logo.
*/
add_theme_support( 'custom-logo', array(
'height' => 100,
'width' => 200,
'flex-width' => true,
'flex-height' => true,
) );
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for Boostrap Nav Menu Walker
* https://github.com/dupkey/bs4navwalker
*/
require_once( get_template_directory() . '/inc/bs4navwalker.php' );
/**
* This theme styles the visual editor to resemble the theme style,
* specifically font, colors, icons, and column width.
*/
add_editor_style( array( 'css/editor-style.css', astrothemes_fonts_url() ) );
/**
* Add support for Customizer.
*/
require_once( get_template_directory() . '/inc/customizer.php' );
}
endif; // astrothemes_setup
add_action( 'after_setup_theme', 'astrothemes_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) ) $content_width = 1140;
/**
* Register custom fonts.
*/
function astrothemes_fonts_url() {
$fonts_url = '';
$font_families = array();
$subsets = 'latin,latin-ext';
/*
* Translators: If there are characters in your language that are not
* supported by Lato, translate this to 'off'. Do not translate
* into your own language.
*/
if ( 'off' !== _x( 'on', 'Lato font: on or off', 'apollohotel' ) ) {
$font_families[] = 'Lato:300,300i,400,400i,700,700i';
}
if ( $font_families ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( $subsets ),
), '//fonts.googleapis.com/css' );
}
return esc_url_raw($fonts_url);
}
/**
* Add preconnect for Google Fonts.
*/
function astrothemes_resource_hints( $urls, $relation_type ) {
if ( wp_style_is( 'apollohotel-fonts', 'queue' ) && 'preconnect' === $relation_type ) {
$urls[] = array(
'href' => '//fonts.gstatic.com',
'crossorigin',
);
}
return $urls;
}
add_filter( 'wp_resource_hints', 'astrothemes_resource_hints', 10, 2 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function astrothemes_widgets_init() {
// sidebar standard
register_sidebar( array(
'name' => __( 'Main Sidebar', 'apollohotel' ),
'id' => 'sidebar',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'apollohotel' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
// footer col-1
register_sidebar( array(
'name' => __( 'Footer: Column 1', 'apollohotel' ),
'id' => 'footer-col-1',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'apollohotel' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
// footer col-2
register_sidebar( array(
'name' => __( 'Footer: Column 2', 'apollohotel' ),
'id' => 'footer-col-2',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'apollohotel' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
// footer col-3
register_sidebar( array(
'name' => __( 'Footer: Column 3', 'apollohotel' ),
'id' => 'footer-col-3',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'apollohotel' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
// footer col-4
register_sidebar( array(
'name' => __( 'Footer: Column 4', 'apollohotel' ),
'id' => 'footer-col-4',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'apollohotel' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '
',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'astrothemes_widgets_init' );
/**
* AstroThemes Custom Search Form for Bootstrap 4.
*/
function astrothemes_custom_search_form( $form ) {
$form = '';
return $form;
}
add_filter( 'get_search_form', 'astrothemes_custom_search_form', 100 );
/**
* Replaces the default custom logo class attribute with the bootstrap navbar-brand.
*/
function astrothemes_custom_logo_mod() {
$custom_logo_id = get_theme_mod( 'custom_logo' );
$image = wp_get_attachment_image( $custom_logo_id, 'full', false, array(
'class' => 'custom-logo',
)
);
if (!$image) { return false; }
$html = sprintf(
'