__( 'Primary Menu', 'plane' ),
) );
}
endif;
add_action( 'after_setup_theme', 'plane_setup' );
/* Register widget area. */
function plane_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'plane' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer #1', 'plane' ),
'id' => 'sidebar-2',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer #2', 'plane' ),
'id' => 'sidebar-3',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer #3', 'plane' ),
'id' => 'sidebar-4',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer #4', 'plane' ),
'id' => 'sidebar-5',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'plane_widgets_init' );
/*-----------------------------------------------------------------------------------*/
/* Returns the Google font stylesheet URL, if available.
/* ----------------------------------------------------------------------------------*/
function plane_fonts_url() {
$fonts_url = '';
/* Raleway */
$raleway = _x( 'on', 'Raleway font: on or off', 'plane' );
/* Noto Serif */
$noto_serif = _x( 'on', 'Noto Serif font: on or off', 'plane' );
if ( 'off' !== $raleway || 'off' !== $noto_serif ) {
$font_families = array();
if ( 'off' !== $raleway )
$font_families[] = 'Raleway:400,500,700,900';
if ( 'off' !== $noto_serif )
$font_families[] = 'Noto Serif:400,700,400italic,700italic';
$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 plane_scripts() {
wp_enqueue_script( 'plane-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'plane-scripts', get_template_directory_uri() . '/js/plane.js', array( 'jquery' ), '20140715', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'plane_scripts' );
function plane_styles() {
wp_enqueue_style( 'plane-icons', get_template_directory_uri().'/css/font-awesome.css', array(), '4.0.3' );
wp_enqueue_style( 'plane-fonts', plane_fonts_url() );
wp_enqueue_style( 'plane-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'plane_styles' );
/*-----------------------------------------------------------------------------------*/
/* Actions
/* ----------------------------------------------------------------------------------*/
/**
* Sets the authordata global when viewing an author archive.
*/
function plane_setup_author() {
global $wp_query;
if ( $wp_query->is_author() && isset( $wp_query->post ) ) {
$GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author );
}
}
add_action( 'wp', 'plane_setup_author' );
/*-----------------------------------------------------------------------------------*/
/* Filters
/* ----------------------------------------------------------------------------------*/
/**
* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link.
*/
function plane_page_menu_args( $args ) {
$args['show_home'] = true;
$args['menu_class'] = 'nav-menu';
return $args;
}
add_filter( 'wp_page_menu_args', 'plane_page_menu_args' );
/**
* Excerpt handling
*/
function plane_continue_reading_link() {
return ' ' . __( 'Continue reading →', 'plane' ) . '
';
}
function plane_custom_excerpt( $output ) {
if ( has_excerpt() && ! is_attachment() ) {
$output .= '… ' . plane_continue_reading_link();
}
return $output;
}
add_filter( 'get_the_excerpt', 'plane_custom_excerpt' );
function plane_auto_excerpt_more( $output ) {
$output = '';
$output .= '… ' . plane_continue_reading_link();
return $output;
}
add_filter( 'excerpt_more', 'plane_auto_excerpt_more' );
function plane_excerpt_length( $length ) {
return 40;
}
add_filter( 'excerpt_length', 'plane_excerpt_length' );
/**
* Adds custom classes to the array of body classes.
*/
function plane_body_classes( $classes ) {
if ( ! is_active_sidebar( 'sidebar-1' ) ) {
$classes[] = 'no-sidebar';
}
if ( is_page() && ! comments_open() && '0' == get_comments_number() ) {
$classes[] = 'comments-closed';
}
return $classes;
}
add_filter( 'body_class', 'plane_body_classes' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Load Jetpack compatibility file.
*/
require get_template_directory() . '/inc/jetpack.php';