'',
'flex-width' => true,
'width' => 864,
'flex-height' => true,
'height' => 200,
'uploads' => true,
'random-default' => false,
'header-text' => false,
'default-text-color' => '',
'wp-head-callback' => 'blogkori_header_style',
'admin-head-callback' => '',
'admin-preview-callback' => '',
);
add_theme_support( 'custom-header', $blogkori_defaults );
// Register the navigation menu
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'blogkori' )
) );
//Post thumbnails need this in functions.php
add_theme_support('post-thumbnails');
add_image_size( 'blogkori-category-thumb', 300, 300 );
}
endif;
add_action('after_setup_theme', 'blogkori_setup');
// Add scripts
function blogkori_scripts() {
// Load bootstrap stylesheet
wp_enqueue_style( 'bootstrap', get_template_directory_uri().'/css/bootstrap.min.css' );
// Load theme stylesheet
wp_enqueue_style( 'blogkori-style', get_stylesheet_uri());
// Load bootstrap javascript
wp_enqueue_script( 'bootstrap-scripts', get_template_directory_uri() . '/js/bootstrap.min.js', array(), '3.3.2', true );
// Load jquery
wp_enqueue_script('jquery');
// Comment reply script
if ( is_singular() && get_option( 'thread_comments' ) ) wp_enqueue_script( 'comment-reply' );
}
add_action( 'wp_enqueue_scripts', 'blogkori_scripts' );
// 1. customizer-preview.js
function blogkori_customize_preview_js() {
wp_enqueue_script( 'tuts_customizer_preview', get_template_directory_uri() . '/inc/customizer-preview.js', array( 'customize-preview' ), null, true );
}
add_action( 'customize_preview_init', 'blogkori_customize_preview_js' );
// 2. customizer-control.js
function blogkori_customize_control_js() {
wp_enqueue_script( 'tuts_customizer_control', get_template_directory_uri() . '/inc/customizer-control.js', array( 'customize-controls', 'jquery' ), null, true );
}
add_action( 'customize_controls_enqueue_scripts', 'blogkori_customize_control_js' );
// Adding page navigation
$blogkori_pg_defaults = array(
'before' => '
' . __( 'Pages:', 'blogkori' ),
'after' => '
',
'link_before' => '',
'link_after' => '',
'next_or_number' => 'number',
'separator' => ' ',
'nextpagelink' => __( 'Next page', 'blogkori' ),
'previouspagelink' => __( 'Previous page', 'blogkori' ),
'pagelink' => '%',
'eco' => 1
);
// Default Content Width
if ( ! isset( $content_width ) ) $content_width = 640;
// Theme options page
require_once ( get_template_directory() . '/theme-options.php' );
// Register Custom Navigation Walker
require_once('wp-bootstrap-navwalker.php');
// Add ID and CLASS attributes to the first occurence in wp_page_menu
function blogkori_add_menuclass( $blogkori_ulclass ) {
return preg_replace( '//', '', $blogkori_ulclass, 1 );
}
add_filter( 'wp_page_menu', 'blogkori_add_menuclass' );
// Registering The Sidebars
function blogkori_sidebar() {
register_sidebar( array(
'name' => __( 'Right Sidebar', 'blogkori' ),
'id' => 'sidebar-1',
'description' => __( 'Widgets in this area will be shown on all posts and pages.', 'blogkori' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
'
) );
}
add_action( 'widgets_init', 'blogkori_sidebar' );
// Next previous navigation Links
$next_args = array(
'mid_size' => 3,
'prev_text' => __('Newer posts', 'blogkori'),
'next_text' => __('Older posts', 'blogkori')
);
// Custom comment callback
function blogkori_comments_callback( $blogkori_comment, $blogkori_args, $blogkori_depth ) {
$GLOBALS['comment'] = $blogkori_comment;
?>
- id="comment-">
add_setting('theme_accent_color', array(
'default' => '#25aae2',
'transport' => 'postMessage',
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_hex_color',
)
);
// Theme links color
$wp_customize->add_setting('theme_link_color', array(
'default' => '#2198f4',
'transport' => 'postMessage',
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_hex_color',
)
);
// Theme text color
$wp_customize->add_setting('theme_text_color', array(
'default' => '#333333',
'transport' => 'postMessage',
'type' => 'theme_mod',
'sanitize_callback' => 'sanitize_hex_color',
)
);
// Adding the accent color Controls
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'theme_bg_color', array(
'label' => __('Primary theme color', 'blogkori'),
'section' => 'colors',
'settings' => 'theme_accent_color'
)
)
);
$wp_customize->add_control(
new WP_Customize_Color_Control(
$wp_customize,
'theme_link_color', array(
'label' => __('Link color', 'blogkori'),
'section' => 'colors',
'settings' => 'theme_link_color'
)
)
);
}
add_action( 'customize_register', 'blogkori_customize_register' );
// Add scripts to wp_head()
function google_analytics_script() {
$options = get_option('blogkori_theme_options');
echo $options['googanalytics'];
}
add_action( 'wp_head', 'google_analytics_script' );
if ( ! function_exists( 'blogkori_header_style' ) ) :
/**
* Styles the header image and text displayed on the blog.
*
* @see blogkori_custom_header_setup().
*/
function blogkori_header_style() {
$theme_accent_color = get_theme_mod('theme_accent_color');
$theme_link_color = get_theme_mod('theme_link_color');
/*
* If no custom options for text are set, let's bail.
* get_header_textcolor() options: Any hex value, 'blank' to hide text. Default: add_theme_support( 'custom-header' ).
*/
if ('#25aae2' != $theme_accent_color) { ?>
__( 'Reply', 'blogkori' ), 'depth' => $blogkori_depth, 'max_depth' => $blogkori_args['max_depth'] ) ) ); ?>