__( 'Primary Menu', 'typo' ),
'footer' => __( 'Footer Menu', 'typo' ),
) );
/**
* Enable support for Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'audio', 'chat', 'status' ) );
/**
* Setup the WordPress core custom background feature.
*/
add_theme_support( 'custom-background', apply_filters( 'typo_custom_background_args', array(
'default-color' => 'eeeeee',
'default-image' => '%1$s/images/body-bg.png',
) ) );
}
endif; // typo_setup
add_action( 'after_setup_theme', 'typo_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function typo_widgets_init() {
register_sidebar( array(
'name' => __( 'Footer Sidebar 1', 'typo' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer Sidebar 2', 'typo' ),
'id' => 'sidebar-2',
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Sidebar 3', 'typo' ),
'id' => 'sidebar-3',
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'typo_widgets_init' );
/**
* Register Google Fonts
*/
function typo_google_fonts() {
/* translators: If there are characters in your language that are not supported
by Vast Shadow, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Vast Shadow font: on or off', 'typo' ) ) {
wp_register_style( 'typo-vast-shadow', "https://fonts.googleapis.com/css?family=Vast+Shadow" );
}
/* translators: If there are characters in your language that are not supported
by Droid Serif, translate this to 'off'. Do not translate into your own language. */
if ( 'off' !== _x( 'on', 'Droid Serif font: on or off', 'typo' ) ) {
wp_register_style( 'typo-droid-serif', "https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic" );
}
}
add_action( 'init', 'typo_google_fonts' );
/**
* Filter TinyMCE CSS path to include Google Fonts.
*
* Adds additional stylesheets to the TinyMCE editor if needed.
*
* @param string $mce_css CSS path to load in TinyMCE.
* @return string Filtered CSS path.
*/
function typo_mce_css( $mce_css ) {
$font_url = 'https://fonts.googleapis.com/css?family=Droid+Serif:400,700,400italic,700italic|Vast+Shadow';
if ( empty( $font_url ) )
return $mce_css;
if ( ! empty( $mce_css ) )
$mce_css .= ',';
$mce_css .= esc_url_raw( str_replace( ',', '%2C', $font_url ) );
return $mce_css;
}
add_filter( 'mce_css', 'typo_mce_css' );
/**
* Grab the first URL from a Link post
*/
function typo_url_grabber() {
if ( ! preg_match( '/]*?href=[\'"](.+?)[\'"]/is', get_the_content(), $matches ) )
return false;
return esc_url_raw( $matches[1] );
}
/**
* Enqueue Google Fonts for custom headers
*/
function typo_admin_scripts( $hook_suffix ) {
if ( 'appearance_page_custom-header' != $hook_suffix )
return;
wp_enqueue_style( 'typo-vast-shadow' );
wp_enqueue_style( 'typo-droid-serif' );
}
add_action( 'admin_enqueue_scripts', 'typo_admin_scripts' );
/**
* Enqueue scripts and styles
*/
function typo_scripts() {
wp_enqueue_style( 'typo-style', get_stylesheet_uri() );
wp_enqueue_style( 'genericons', get_template_directory_uri() . '/genericons/genericons.css', array(), '3.3.1' );
wp_enqueue_script( 'typo-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'typo-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
wp_enqueue_style( 'typo-vast-shadow' );
wp_enqueue_style( 'typo-droid-serif' );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'typo-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
}
add_action( 'wp_enqueue_scripts', 'typo_scripts' );
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.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';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Load Jetpack compatibility file.
*/
if ( file_exists( get_template_directory() . '/inc/jetpack.php' ) )
require get_template_directory() . '/inc/jetpack.php';