__( 'Primary Menu', 'aaron' ),
'social' => __( 'Social Menu', 'aaron' ),
) );
/*
* 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_action( 'after_setup_theme', 'aaron_setup' );
/**
* Aaron_hide_search
*
* Unless the option is hidden in the customizer, display a search form in the primary menu.
*/
if ( ! get_theme_mod( 'aaron_hide_search' ) ) {
function aaron_menu_search( $items, $args ) {
if ( 'header' === $args->theme_location ) {
$items = $items . '
' . get_search_form( false ) . '';
}
return $items;
}
add_filter( 'wp_nav_menu_items','aaron_menu_search', 10, 2 );
}
/**
* Aaron_hide_title
*
* Unless the option is hidden in the customizer, display the site title (with link) in the primary menu.
*/
if ( ! get_theme_mod( 'aaron_hide_title' ) ) {
function aaron_menu_title( $items, $args ) {
if ( 'header' === $args->theme_location ) {
$new_item = array( '' . get_bloginfo( 'name' ) . '' );
$items = preg_replace( '/<\/li>\s, __( 'Sidebar', 'aaron' ),
'id' => 'sidebar-1',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Front page sidebar', 'aaron' ),
'id' => 'sidebar-front',
'description' => __( 'This sidebar will only be visible on the front page and the blog index', 'aaron' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer widget area', 'aaron' ),
'id' => 'sidebar-2',
'description' => '',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Header widget area', 'aaron' ),
'id' => 'sidebar-header',
'description' => __( 'Widgets in this area are displayed in the header, below the highlights.', 'aaron' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer copyright area', 'aaron' ),
'id' => 'sidebar-copyright',
'description' => __( 'Place a text widget in this area and add your copyright text', 'aaron' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
) );
}
add_action( 'widgets_init', 'aaron_widgets_init' );
if ( ! function_exists( 'aaron_fonts_url' ) ) {
function aaron_fonts_url() {
$fonts_url = '';
$fonts = array();
$subsets = 'latin,latin-ext';
$fonts[] = get_theme_mod( 'aaron_font', 'Montserrat' );
/* 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 = _x( 'no-subset', 'Add new subset (greek, cyrillic, devanagari, vietnamese)', 'aaron' );
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 ),
), '//fonts.googleapis.com/css' );
}
return $fonts_url;
}
}
/**
* Enqueue scripts and styles.
*/
function aaron_scripts() {
wp_enqueue_style( 'aaron-style', get_stylesheet_uri(), array( 'dashicons' ) );
wp_enqueue_style( 'aaron-fonts', aaron_fonts_url(), array(), null );
wp_enqueue_style( 'open-sans' );
wp_enqueue_script( 'aaron-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
wp_enqueue_script( 'aaron-navigation', get_template_directory_uri() . '/js/navigation.js', array( 'jquery' ), '20120206', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_page_template( 'templates/grid.php' ) ) {
wp_enqueue_script( 'masonry' );
wp_enqueue_script( 'aaron-grid', get_template_directory_uri() . '/js/grid.js', array(), true );
}
/* If using a child theme, auto-load the parent theme style. */
if ( is_child_theme() ) {
wp_enqueue_style( 'parent-style', trailingslashit( get_template_directory_uri() ) . 'style.css' );
}
}
add_action( 'wp_enqueue_scripts', 'aaron_scripts' );
/**
* Enqueue styles for the setup help page.
*/
function aaron_admin_scripts( $hook ) {
if ( 'appearance_page_aaron-theme' !== $hook ) {
return;
}
wp_enqueue_style( 'aaron-admin-style', get_template_directory_uri() . '/admin.css' );
}
add_action( 'admin_enqueue_scripts', 'aaron_admin_scripts' );
/**
* Custom header for this theme.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';
/**
* Load Highlights
*/
require get_template_directory() . '/inc/highlights.php';
/**
* Meta boxes for the header settings.
*/
require get_template_directory() . '/inc/metabox.php';
/**
* Setup help
*/
require get_template_directory() . '/documentation.php';
/* Add a title to posts that are missing titles */
add_filter( 'the_title', 'aaron_post_title' );
function aaron_post_title( $title ) {
if ( $title === '' ) {
return __( '(Untitled)', 'aaron' );
} else {
return $title;
}
}
add_filter( 'body_class', 'aaron_classes' );
function aaron_classes( $classes ) {
/*
* Is the sidebar inactive? Add 'no-sidebar' to the $classes array
* Is the meta turned off in the customizer? Add 'no-meta' to the $classes array
*/
if ( is_front_page() && ! is_active_sidebar( 'sidebar-front' ) || is_home() && ! is_active_sidebar( 'sidebar-front' ) ) {
$classes[] = 'no-sidebar';
} else {
if ( ! is_active_sidebar( 'sidebar-1' ) && ! is_front_page() && ! is_home() ) {
$classes[] = 'no-sidebar';
}
}
if ( get_theme_mod( 'aaron_hide_meta' ) ) {
$classes[] = 'no-meta';
}
// Adds a class of group-blog to blogs with more than 1 published author.
if ( is_multi_author() ) {
$classes[] = 'group-blog';
}
return $classes;
}
function aaron_customize_css() {
echo '';
}
add_action( 'wp_head', 'aaron_customize_css' );