__( 'Primary Menu', 'the_columnist' ),
) );
// This theme allows users to set a custom background
add_theme_support( 'custom-background', array( 'default-color' => 'f2f2f2' ) );
}
endif; // the_columnist_setup
add_action( 'after_setup_theme', 'the_columnist_setup' );
/**
* Sets the post excerpt length to 20 characters.
*/
function the_columnist_excerpt_length( $length ) {
return 20;
}
add_filter( 'excerpt_length', 'the_columnist_excerpt_length' );
/**
* Returns a "Continue Reading" link for excerpts
*/
function the_columnist_continue_reading_link() {
return ' ' . __( 'Continue reading →', 'yoko' ) . '';
}
/**
* Replaces "[...]" (appended to automatically generated excerpts) with an ellipsis and the_columnist_continue_reading_link().
*/
function the_columnist_auto_excerpt_more( $more ) {
return the_columnist_continue_reading_link();
}
add_filter( 'excerpt_more', 'the_columnist_auto_excerpt_more' );
/**
* Need to remove the widont filter b/c of limited title space
*/
function the_columnist_wido() {
remove_filter( 'the_title', 'widont' );
}
add_action( 'init', 'the_columnist_wido' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since The Columnist 1.0
*/
function the_columnist_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar 1', 'the_columnist' ),
'id' => 'sidebar-1',
'description' => __( 'Optional widget area for one column of widgets', 'the_columnist' ),
'before_widget' => '',
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Sidebar 2', 'the_columnist' ),
'id' => 'sidebar-2',
'description' => __( 'Optional widget area for two columns of widgets', 'the_columnist' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Sidebar 3', 'the_columnist' ),
'id' => 'sidebar-3',
'description' => __( 'Optional widget area for three columns of widgets', 'the_columnist' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Sidebar 4', 'the_columnist' ),
'id' => 'sidebar-4',
'description' => __( 'Optional widget area for four columns of widgets', 'the_columnist' ),
'before_widget' => '',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'the_columnist_widgets_init' );
/**
* Enqueue scripts and styles
*/
function the_columnist_scripts() {
wp_enqueue_style( 'style', get_stylesheet_uri() );
wp_enqueue_script( 'custom-script', get_template_directory_uri() . '/js/custom-script.js', array( 'jquery' ), false, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) )
wp_enqueue_script( 'comment-reply' );
if ( is_singular() && wp_attachment_is_image( get_post()->ID ) )
wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
add_action( 'wp_enqueue_scripts', 'the_columnist_scripts' );
/**
* Count the number of active sidebars to enable dynamic classes
*/
function the_columnist_sidebar_class() {
$count = 0;
if ( is_active_sidebar( 'sidebar-1' ) )
$count++;
if ( is_active_sidebar( 'sidebar-2' ) )
$count++;
if ( is_active_sidebar( 'sidebar-3' ) )
$count++;
if ( is_active_sidebar( 'sidebar-4' ) )
$count++;
$class = '';
switch ( $count ) {
case '1':
$class = 'one';
break;
case '2':
$class = 'two';
break;
case '3':
$class = 'three';
break;
case '4':
$class = 'four';
break;
}
if ( $class )
echo 'class="' . $class . '"';
}
/**
* 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/tweaks.php';
/**
* Load Jetpack compatibility file.
*/
if ( file_exists( get_template_directory() . '/inc/jetpack.php' ) )
require get_template_directory() . '/inc/jetpack.php';