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
*
*/
add_theme_support( 'post-thumbnails' );
add_image_size( 'lingonberry-post-image', 712, 9999 );
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Location', 'lingonberry' ),
) );
/**
* Enable support for Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'link', 'quote', 'audio', 'chat', 'gallery', 'status' ) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'comment-form', 'gallery', 'caption',
) );
/**
* Setup the WordPress core custom background feature.
*/
add_theme_support( 'custom-background', apply_filters( 'lingonberry_custom_background_args', array(
'default-color' => 'f1f1f1',
'default-image' => '',
) ) );
}
endif; // lingonberry_setup
add_action( 'after_setup_theme', 'lingonberry_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function lingonberry_widgets_init() {
register_sidebar( array(
'name' => __( 'Footer 1', 'lingonberry' ),
'id' => 'sidebar-1',
'before_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 2', 'lingonberry' ),
'id' => 'sidebar-2',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer 3', 'lingonberry' ),
'id' => 'sidebar-3',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'lingonberry_widgets_init' );
/**
* Returns the Google font stylesheet URL, if available.
*
* The use of Lato and Raleway by default is localized. For languages
* that use characters not supported by the font, the font can be disabled.
*
* @return string Font stylesheet or empty string if disabled.
*/
function lingonberry_fonts_url() {
$fonts_url = '';
/* 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.
*/
$lato = _x( 'on', 'Lato font: on or off', 'lingonberry' );
/* Translators: If there are characters in your language that are not
* supported by Raleway, translate this to 'off'. Do not translate into your
* own language.
*/
$raleway = _x( 'on', 'Raleway font: on or off', 'lingonberry' );
if ( 'off' !== $lato || 'off' !== $raleway ) {
$font_families = array();
if ( 'off' !== $lato )
$font_families[] = 'Lato:400,400italic,700,700italic';
if ( 'off' !== $raleway )
$font_families[] = 'Raleway:400,500,600';
$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 $fonts_url;
}
/**
* Enqueue scripts and styles
*/
function lingonberry_scripts() {
wp_enqueue_style( 'lingonberry-style', get_stylesheet_uri() );
// Add Lato and Raleway fonts, used in the main stylesheet.
wp_enqueue_style( 'lingonberry-fonts', lingonberry_fonts_url(), array(), null );
wp_enqueue_script( 'lingonberry-global', get_template_directory_uri() . '/js/global.js', array( 'jquery' ), '', true );
wp_enqueue_script( 'lingonberry-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'lingonberry_scripts' );
/**
* Replaces the excerpt "more" text with a link
*/
function lingonberry_excerpt_more( $more ) {
global $post;
return '&ellipsis;' . __( 'Read the full post »', 'lingonberry' ) . '';
}
add_filter( 'excerpt_more', 'lingonberry_excerpt_more' );
/**
* Adds a `.post-listing` class to the blog, the archives, and the search listings.
*
* This class is used to style post formats (link, quote) differently on these pages.
*/
function lingonberry_body_class( $classes ) {
if ( is_home() || is_archive() || is_search() ) {
$classes[] = 'post-listing';
}
return $classes;
}
add_action( 'body_class', 'lingonberry_body_class' );
/**
* 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';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';