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 http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'gateway-post-image', 365, 365, true );
add_image_size( 'gateway-page-image', 500, 500, true );
add_image_size( 'gateway-home', 2560, 1706, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'gateway' ),
) );
/*
* 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( 'gateway_custom_background_args', array(
'default-color' => 'ffffff',
) ) );
}
endif; // gateway_setup
add_action( 'after_setup_theme', 'gateway_setup' );
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function gateway_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'gateway' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 1', 'gateway' ),
'id' => 'footer-1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 2', 'gateway' ),
'id' => 'footer-2',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer 3', 'gateway' ),
'id' => 'footer-3',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'gateway_widgets_init' );
/*----------------------------------------------------*/
/* Enqueue scripts and styles.
/*----------------------------------------------------*/
function gateway_scripts() {
wp_enqueue_style( 'gateway-parent-styles', get_stylesheet_uri() );
wp_enqueue_style( 'gateway-fonts', gateway_fonts(), array(), null );
wp_enqueue_style( 'gateway-font-awesome', get_template_directory_uri() . '/fonts/css/font-awesome.css' );
wp_enqueue_script( 'gateway-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20130115', true );
wp_enqueue_script( 'gateway-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array( 'jquery' ), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'gateway_scripts', 10 );
if ( ! function_exists( 'gateway_fonts' ) ) :
/**
* Register Google fonts
*
*/
function gateway_fonts() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
/* translators: If there are characters in your language that are not supported by Quattrocento, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== esc_html_x( 'on', 'Quattrocento font: on or off', 'gateway' ) ) {
$fonts[] = 'Quattrocento:400,700';
}
/* translators: If there are characters in your language that are not supported by Fanwood Text, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== esc_html_x( 'on', 'Fanwood Text font: on or off', 'gateway' ) ) {
$fonts[] = 'Fanwood Text:400,400italic';
}
/* translators: To add an additional character subset specific to your language, translate this to 'greek', 'cyrillic', 'devanagari' or 'vietnamese'. Do not translate into your own language. */
$subset = esc_html_x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'gateway' );
if ( 'cyrillic' == $subset ) {
$subsets .= ',cyrillic,cyrillic-ext';
} elseif ( 'greek' == $subset ) {
$subsets .= ',greek,greek-ext';
} elseif ( 'devanagari' == $subset ) {
$subsets .= ',devanagari';
} elseif ( 'vietnamese' == $subset ) {
$subsets .= ',vietnamese';
}
if ( $fonts ) {
$fonts_url = add_query_arg( array(
'family' => urlencode( implode( '|', $fonts ) ),
'subset' => urlencode( $subsets ),
), 'https://fonts.googleapis.com/css' );
}
return $fonts_url;
}
endif;
if ( ! function_exists( 'gateway_home_header' ) ) :
function gateway_home_header() {
if ( ! is_page_template( 'template-home.php' ) || ! has_post_thumbnail() )
return;
$featured = wp_get_attachment_image_src( get_post_thumbnail_id(), 'gateway-home' );
$header_position = esc_attr( get_theme_mod( 'header_position', 'fixed' ) );
?>
' . sprintf( wp_kses_post( __( 'More %1$s', 'gateway' ) ), esc_attr( strip_tags( get_the_title() ) ) ) . '';
}
endif; // gateway_continue_reading_link
/**
* Replaces "[...]" (appended to automatically generated excerpts) with gateway_continue_reading_link().
*
* To override this in a child theme, remove the filter and add your own
* function tied to the excerpt_more filter hook.
*/
function gateway_auto_excerpt_more( $more ) {
return gateway_continue_reading_link();
}
add_filter( 'excerpt_more', 'gateway_auto_excerpt_more' );
/**
* Adds a pretty "Continue Reading" link to custom post excerpts.
*
* To override this link in a child theme, remove the filter and add your own
* function tied to the get_the_excerpt filter hook.
*/
function gateway_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= gateway_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'gateway_custom_excerpt_more' );
/**
* Custom Header support
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Customizer support
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';