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( 'cerauno-home', 900, 300, true );
add_image_size( 'cerauno-header', 1400, 400, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'cerauno' ),
'social' => esc_html__( 'Social Links', 'cerauno' ),
) );
/*
* 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( 'cerauno_custom_background_args', array(
'default-color' => 'ffffff',
) ) );
}
endif; // cerauno_setup
add_action( 'after_setup_theme', 'cerauno_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 cerauno_content_width() {
$GLOBALS['content_width'] = apply_filters( 'cerauno_content_width', 900 );
}
add_action( 'after_setup_theme', 'cerauno_content_width', 0 );
/**
* Register widget area.
*
* @link http://codex.wordpress.org/Function_Reference/register_sidebar
*/
function cerauno_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar 1', 'cerauno' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Sidebar 2', 'cerauno' ),
'id' => 'sidebar-2',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar 1', 'cerauno' ),
'id' => 'footer-1',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar 2', 'cerauno' ),
'id' => 'footer-2',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Sidebar 3', 'cerauno' ),
'id' => 'footer-3',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'cerauno_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function cerauno_scripts() {
wp_enqueue_style( 'cerauno-style', get_stylesheet_uri() );
wp_enqueue_style( 'cerauno-fonts', cerauno_fonts_url(), array(), null );
wp_enqueue_style( 'cerauno-fontawesome', get_template_directory_uri() . '/fonts/font-awesome.css', array(), '4.3.0' );
wp_enqueue_script( 'cerauno-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'cerauno-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', 'cerauno_scripts' );
/**
* Register Google Fonts
*/
function cerauno_fonts_url() {
$fonts_url = '';
/* Translators: If there are characters in your language that are not
* supported by Karla, translate this to 'off'. Do not translate
* into your own language.
*/
$karla = esc_html_x( 'on', 'Karla font: on or off', 'cerauno' );
/* Translators: If there are characters in your language that are not
* supported by Montserrat, translate this to 'off'. Do not translate
* into your own language.
*/
$montserrat = esc_html_x( 'on', 'Montserrat font: on or off', 'cerauno' );
if ( 'off' !== $karla && 'off' !== $montserrat ) {
$font_families = array();
if ( 'off' !== $karla ) {
$font_families[] = 'Karla:400,400italic,700,700italic';
}
if ( 'off' !== $montserrat ) {
$font_families[] = 'Montserrat:400,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 $fonts_url;
}
/**
* Enqueue Google Fonts for custom headers
*/
function cerauno_admin_scripts( $hook_suffix ) {
wp_enqueue_style( 'cerauno-fonts', cerauno_fonts_url(), array(), null );
}
add_action( 'admin_print_styles-appearance_page_custom-header', 'cerauno_admin_scripts' );
if ( ! function_exists( 'cerauno_continue_reading_link' ) ) :
/**
* Returns an ellipsis and "Continue reading" plus off-screen title link for excerpts
*/
function cerauno_continue_reading_link() {
return '… ' . sprintf( __( 'Read More %1$s', 'cerauno' ), esc_attr( strip_tags( get_the_title() ) ) ) . '';
}
endif; // cerauno_continue_reading_link
/**
* Replaces "[...]" (appended to automatically generated excerpts) with cerauno_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 cerauno_auto_excerpt_more( $more ) {
return cerauno_continue_reading_link();
}
add_filter( 'excerpt_more', 'cerauno_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 cerauno_custom_excerpt_more( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= cerauno_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'cerauno_custom_excerpt_more' );
if ( ! function_exists( 'cerauno_comments' ) ) :
/*
* Custom comments display to move Reply link,
* used in comments.php
*/
function cerauno_comments( $comment, $args, $depth ) {
?>