__( 'Primary Menu', 'next-saturday' ),
) );
}
// Action hook to do all the major theme setup stuff
add_action( 'after_setup_theme', 'next_saturday_setup' );
// Load scripts
function next_saturday_scripts() {
wp_enqueue_style( 'next-saturday', get_stylesheet_uri() );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'next_saturday_scripts' );
/**
* Audio helper script.
*
* If an audio shortcode exists we will enqueue javascript
* that replaces all non-supported audio player instances
* with text links.
*
* @uses shortcode_exists();
*/
function next_saturday_audio_script() {
if ( shortcode_exists( 'audio' ) )
return;
if ( ! is_singular() || has_post_format( 'audio' ) )
wp_enqueue_script( 'next-saturday-audio', get_template_directory_uri() . '/js/audio.js', array(), '20130521' );
}
add_action( 'wp_enqueue_scripts', 'next_saturday_audio_script' );
/**
* Setup the WordPress core custom background feature.
*
* Use add_theme_support to register support for WordPress 3.4+
* as well as provide backward compatibility for previous versions.
* Use feature detection of wp_get_theme() which was introduced
* in WordPress 3.4.
*
* Hooks into the after_setup_theme action.
*/
function next_saturday_custom_background() {
add_theme_support( 'custom-background', apply_filters( 'next_saturday_custom_background_args', array(
'default-color' => '',
'default-image' => '',
) ) );
}
add_action( 'after_setup_theme', 'next_saturday_custom_background' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function next_saturday_widgets_init() {
register_sidebar( array (
'name' => __( 'Default sidebar', 'next-saturday' ),
'id' => 'sidebar-1',
'description' => __( 'The primary widget area.', 'next-saturday' ),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
}
// We should actually hook into 'widgets_init', but don't for child theme compat.
add_action( 'init', 'next_saturday_widgets_init' );
/**
* Removes the default styles that are packaged with the Recent Comments widget.
*/
function next_saturday_remove_recent_comments_style() {
global $wp_widget_factory;
if ( isset( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'] ) ) {
remove_action( 'wp_head', array( $wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style' ) );
}
}
add_action( 'widgets_init', 'next_saturday_remove_recent_comments_style' );
/**
* Prints HTML with meta information for the fancy display of the current post's month and day
*/
function next_saturday_entry_date() {
printf( __( '
', '' );
if ( $first_image && defined( 'WPCOM_THEMES_IMAGE_REPLACE_REGEX' ) )
$content = preg_replace( WPCOM_THEMES_IMAGE_REPLACE_REGEX, $first_image, $content, 1 );
$content = wp_kses_post( $content );
}
return $content;
}
if ( ! is_admin() )
add_filter( 'the_content', 'next_saturday_the_content', 11 );
/**
* Get a short-form mime type for an audio file to display as a class attribute.
*
* @param int ID of an attachment
* @return string A short representation of the file's mime type.
*/
function next_saturday_post_classes( $classes ) {
if ( has_post_format( 'audio' ) ) {
$audio = next_saturday_audio_grabber( get_the_ID() );
if ( ! empty( $audio ) && is_object( $audio ) ) {
$mime = str_replace( 'audio/', '', get_post_mime_type( $audio->ID ) );
if ( in_array( $mime, array( 'mp3', 'ogg', 'wav', ) ) )
$classes[] = $mime;
}
}
return $classes;
}
add_filter( 'post_class', 'next_saturday_post_classes' );
if ( ! function_exists( 'the_post_format_audio' ) ) :
/**
* Shiv for the_post_format_audio().
*
* the_post_format_audio() is part of a core plugin. To provide backward
* compatibility with previous versions, we will define our
* own version of this function.
*
* @param string $name The name of the shortcode.
* @return bool True if shortcode exists; False otherwise.
*/
function the_post_format_audio() {
$audio = next_saturday_audio_grabber( get_the_ID() );
if ( ! empty( $audio ) && is_object( $audio ) ) :
$url = wp_get_attachment_url( $audio->ID );
?>