__( 'Primary Menu', 'tashan' ),
'secondary' => __( 'Secondary Menu', 'tashan' ),
) );
/**
* Enable support for Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) );
/**
* Setup the WordPress core custom background feature.
*/
add_theme_support( 'custom-background', apply_filters( 'tashan_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif; // tashan_setup
add_action( 'after_setup_theme', 'tashan_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function tashan_widgets_init() {
register_sidebar( array(
'name' => __( 'Header Widget', 'tashan' ),
'description' => __( 'Intended for adding the Jetpack subscribe form and no other widgets. Note: This widget will fade and disappear with the header - this is the intentional behavior of the Skrollr Script.', 'tashan' ),
'id' => 'header-widget',
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Showcase - Above Content', 'tashan' ),
'id' => 'showcase',
'description' => __( 'Displays just above the mainbody. You can add up to 5 widgets in this location.', 'tashan' ),
'before_widget' => '',
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Sidebar', 'tashan' ),
'id' => 'sidebar-1',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'tashan_widgets_init' );
get_template_part( '/inc/widgets/tashan-recent-comment');
get_template_part( '/inc/widgets/tashan-recent-posts');
function load_tashan_widgets() {
register_widget("Tashan_RecentCommentWidget");
register_widget("Tashan_RecentPostWidget");
}
add_action("widgets_init", "load_tashan_widgets");
/**
* Returns number of widgets in a widget position - used in the Showcase and Footer widget areas.
*
* @since 1.0.0
* @return int
*/
function tashan_position_count( $position ) {
$sidebar_widgets = wp_get_sidebars_widgets();
if( isset( $sidebar_widgets[$position] ) ) {
return count( $sidebar_widgets[$position] );
}
return 0;
}
/**
* Enqueue scripts and styles
*/
function tashan_scripts() {
global $wp_styles;
// CSS Scripts
wp_enqueue_style('tashan-style', get_template_directory_uri().'/css/style.css', false ,'1.0.0', 'all' );
wp_enqueue_style('tashan-bootstrap', get_template_directory_uri().'/css/bootstrap.css', false ,'2.2.2', 'all' );
wp_enqueue_style('tashan-responsive', get_template_directory_uri().'/css/bootstrap-responsive.css', false ,'2.2.2', 'all' );
wp_enqueue_style('tashan-custom', get_template_directory_uri().'/css/custom.css', false ,'1.0.0', 'all' );
// Load style.css from child theme
if (is_child_theme()) {
wp_enqueue_style('tashan_child', get_stylesheet_uri(), false, null);
}
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script('respond.js', get_template_directory_uri().'/js/respond/respond.js', array('jquery'),'1.1.0', false );
wp_enqueue_script('bootstrap.min.js', get_template_directory_uri().'/js/bootstrap.min.js', array('jquery'),'1.0', true );
wp_enqueue_script('tashan-skrollr.js', get_template_directory_uri().'/js/skrollr.js', array('jquery'),'1.0', true );
}
add_action( 'wp_enqueue_scripts', 'tashan_scripts' );
/**
* Sets the post excerpt length to 80 words.
*/
function tashan_excerpt_length($length) {
if ( get_theme_mod('tashan_blogfeed_excerpt_length') ) :
return ( get_theme_mod('tashan_blogfeed_excerpt_length') );
else :
return 80;
endif;
}
add_filter('excerpt_length', 'tashan_excerpt_length');
// Lets do a separate excerpt length for the slider
function tashan_recentpost_excerpt () {
$theContent = trim(strip_tags(get_the_content()));
$output = str_replace( '"', '', $theContent);
$output = str_replace( '\r\n', ' ', $output);
$output = str_replace( '\n', ' ', $output);
if (get_theme_mod( 'tashan_recentpost_excerpt' )) :
$limit = get_theme_mod( 'tashan_recentpost_excerpt' );
else :
$limit = '15';
endif;
$content = explode(' ', $output, $limit);
array_pop($content);
$content = implode(" ",$content)." ";
return strip_tags($content, ' ');
}
/**
* Implement the Custom Header feature.
*/
//require get_template_directory() . '/inc/custom-header.php';
// Not in use yet but working on setting it as a site logo image handler.
/**
* 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.
*/
require get_template_directory() . '/inc/jetpack.php';
require get_template_directory() . '/inc/nav-menu-walker.php';
require get_template_directory() . '/inc/tashan-customizer.php';