add_li_class)) {
$classes[] = $args->add_li_class;
}
return $classes;
}
add_filter('nav_menu_css_class', 'add_additional_class_on_li', 1, 3);
function add_additional_class_on_a($classes, $item, $args)
{
if (isset($args->add_a_class)) {
$classes['class'] = $args->add_a_class;
}
return $classes;
}
add_filter('nav_menu_link_attributes', 'add_additional_class_on_a', 1, 3);
function get_breadcrumb() {
echo 'Home';
if (is_category() || is_single()) {
echo " » ";
the_category(' • ');
if (is_single()) {
echo " » ";
the_title();
}
} elseif (is_page()) {
echo " » ";
echo the_title();
} elseif (is_search()) {
echo " » Search Results for... ";
echo '"';
echo the_search_query();
echo '"';
}
}
// Estimated Reading Time
function vpsb_estimated_reading_time( $content = '') {
$wpm = 200; // Word Per Minute (200 Average)
$text_content = strip_shortcodes( $content ); // Remove Shortcodes
$str_content = strip_tags( $text_content ); // Remove Tags
$word_count = str_word_count( $str_content );
$readtime = ceil( $word_count / $wpm );
if ($readtime == 1) {
$postfix = " minute";
} else {
$postfix = " minutes";
}
$readingtime = $readtime . $postfix;
return $readingtime;
}
add_filter( "term_links-post_tag", 'add_tag_class');
function add_tag_class($links) {
return str_replace('';
$fields['email'] = '';
//unset comment so we can recreate it at the bottom
unset($fields['comment']);
$fields['comment'] = '';
//remove website
unset($fields['url']);
return $fields;
}
add_filter('comment_form_fields', 'gb_comment_form_tweaks');
function bloggerspot_customize_register( $wp_customize ) {
//All our sections, settings, and controls will be added here
$wp_customize->add_panel('panel_id',array(
'panel'=>'panel_id',
'title'=>__('Theme Options', 'blogger-spot'),
'priority'=>10,
));
// Sections here.
$wp_customize->add_section( 'header_section' , array(
'panel' => 'panel_id',
'title' => __( 'Header Banner Text', 'blogger-spot' ),
'priority' => 10,
) );
$wp_customize->add_section('footer_section', array(
'panel' => 'panel_id',
'title' => __('Footer Copyright Text', 'blogger-spot'),
'priority' => 20,
));
$wp_customize->add_section('top_section', array(
'panel' => 'panel_id',
'title' => __('Top Bar', 'blogger-spot'),
'priority' => 30,
));
// First Section.
// Add setting
$wp_customize->add_setting( 'header_text_block', array(
'default' => __( 'Add Your Text Here.', 'blogger-spot' ),
'sanitize_callback' => 'sanitize_text'
) );
// Add control
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'header_text_block',
array(
'label' => __( 'Home Banner Text', 'blogger-spot' ),
'section' => 'header_section',
'settings' => 'header_text_block',
'type' => 'text',
'priority' => 5,
)
)
);
// Second Section
// Add Setting
$wp_customize->add_setting( 'footer_text_block', array(
'default' => __( '© Copyright 2022 Blogger Spot.', 'blogger-spot' ),
'sanitize_callback' => 'sanitize_text'
) );
// Add control
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'footer_text_block',
array(
'label' => __( 'Footer Text', 'blogger-spot' ),
'section' => 'footer_section',
'settings' => 'footer_text_block',
'type' => 'text',
'priority' => 5,
)
)
);
// Third Section - one
// Add Setting
$wp_customize->add_setting( 'top_left_text_block', array(
'default' => __( 'Life is unpredictable.', 'blogger-spot' ),
'sanitize_callback' => 'sanitize_text'
) );
// Add control
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'top_left_text_block',
array(
'label' => __( 'Top Left Text', 'blogger-spot' ),
'section' => 'top_section',
'settings' => 'top_left_text_block',
'type' => 'text',
'priority' => 5,
)
)
);
// Third Section - two
// Add Setting
$wp_customize->add_setting( 'top_right_text_block', array(
'default' => __( 'Your Contact Details.', 'blogger-spot' ),
'sanitize_callback' => 'sanitize_text'
) );
// Add control
$wp_customize->add_control( new WP_Customize_Control(
$wp_customize,
'top_right_text_block',
array(
'label' => __( 'Top Right Text', 'blogger-spot' ),
'section' => 'top_section',
'settings' => 'top_right_text_block',
'type' => 'text',
'priority' => 5,
)
)
);
// Sanitize text
function sanitize_text( $text ) {
return sanitize_text_field( $text );
}
}
add_action( 'customize_register', 'bloggerspot_customize_register' );
function home_banner_text(){
echo esc_html(get_theme_mod( 'header_text_block'));
}
add_action('banner_text', 'home_banner_text');
function footer_copyright_text(){
echo esc_html(get_theme_mod('footer_text_block'));
}
add_action('footer_text','footer_copyright_text');
function top_left_text(){
echo esc_html(get_theme_mod('top_left_text_block'));
}
add_action('top_left_text','top_left_text');
function top_right_text(){
echo esc_html(get_theme_mod('top_right_text_block'));
}
add_action('top_right_text','top_right_text');
function bloggerspot_widgets_init() {
// First footer widget area, located in the footer. Empty by default.
register_sidebar( array(
'name' => __( 'First Footer Widget Area', 'blogger-spot' ),
'id' => 'first-footer-widget-area',
'description' => __( 'The first footer widget area', 'blogger-spot' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
// Register sidebars by running bloggerspot_widgets_init() on the widgets_init hook.
add_action( 'widgets_init', 'bloggerspot_widgets_init' );
function creator_theme()
{
echo 'Developed by Gourav bagora';
}
add_action('creator_theme','creator_theme');
?>