__('Primary Menu', 'bootstrap-basic'),
));
// add post formats support
add_theme_support('post-formats', array('aside', 'image', 'video', 'quote', 'link'));
// add support custom background
add_theme_support(
'custom-background',
apply_filters(
'bootstrap_basic_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
// @since 1.1 or WordPress 5.0+
// make gutenberg support. --------------------------------------------------------------------------------------
// @link https://wordpress.org/gutenberg/handbook/extensibility/theme-support/ reference.
// add wide alignment ( https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/#wide-alignment )
add_theme_support('align-wide');
// support default block styles for front-end ( https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/#default-block-styles )
add_theme_support('wp-block-styles');
// support editor styles ( https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/#editor-styles )
// this one make appearance in editor more close to Bootstrap 3.
add_theme_support('editor-styles');
// support responsive embeds for front-end ( https://wordpress.org/gutenberg/handbook/designers-developers/developers/themes/theme-support/#responsive-embedded-content )
add_theme_support('responsive-embeds');
// end make gutenberg support. ---------------------------------------------------------------------------------
}// bootstrapBasicSetup
}
add_action('after_setup_theme', 'bootstrapBasicSetup');
if (!function_exists('bootstrapBasicWidgetsInit')) {
/**
* Register widget areas
*/
function bootstrapBasicWidgetsInit()
{
register_sidebar(array(
'name' => __('Sidebar right', 'bootstrap-basic'),
'id' => 'sidebar-right',
'before_widget' => '',
'before_title' => '
',
));
register_sidebar(array(
'name' => __('Sidebar left', 'bootstrap-basic'),
'id' => 'sidebar-left',
'before_widget' => '',
'before_title' => '',
));
register_sidebar(array(
'name' => __('Header right', 'bootstrap-basic'),
'id' => 'header-right',
'description' => __('Header widget area on the right side next to site title.', 'bootstrap-basic'),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'name' => __('Navigation bar right', 'bootstrap-basic'),
'id' => 'navbar-right',
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '',
));
register_sidebar(array(
'name' => __('Footer left', 'bootstrap-basic'),
'id' => 'footer-left',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
register_sidebar(array(
'name' => __('Footer right', 'bootstrap-basic'),
'id' => 'footer-right',
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
));
}// bootstrapBasicWidgetsInit
}
add_action('widgets_init', 'bootstrapBasicWidgetsInit');
if (!function_exists('bootstrapBasicEnqueueScripts')) {
/**
* Enqueue scripts & styles
*
* @global \WP_Scripts $wp_scripts
*/
function bootstrapBasicEnqueueScripts()
{
global $wp_scripts;
$Theme = wp_get_theme();
$themeVersion = $Theme->get('Version');
unset($Theme);
wp_enqueue_style('bootstrap-style');
wp_enqueue_style('bootstrap-theme-style', get_template_directory_uri() . '/css/bootstrap-theme.min.css', array(), '3.4.1');
wp_enqueue_style('fontawesome-style', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.7.0');
wp_enqueue_style('main-style', get_template_directory_uri() . '/css/main.css', array(), $themeVersion);
// check if there are any calendar widget block.
if (bootstrapBasicHasWidgetBlock('calendar') === true) {
// if theme using widget blocks.
// enqueue css to fix calendar widget block to render as non widget block.
// if you would like it to be render as new widget block, please dequeue this handle.
wp_enqueue_style('bootstrapbasic-widgetblocks-calendar', get_template_directory_uri() . '/css/widget-blocks/calendar.css', array(), $themeVersion);
}
// js that is useful for development.
wp_enqueue_script('modernizr-script', get_template_directory_uri() . '/js/vendor/modernizr.min.js', array(), '3.6.0-20190314', true);
// js that is useful for old browsers.
wp_register_script('respond-script', get_template_directory_uri() . '/js/vendor/respond.min.js', array(), '1.4.2', true);
$wp_scripts->add_data('respond-script', 'conditional', 'lt IE 9');
wp_enqueue_script('respond-script');
wp_register_script('html5-shiv-script', get_template_directory_uri() . '/js/vendor/html5shiv.min.js', array(), '3.7.3', true);
$wp_scripts->add_data('html5-shiv-script', 'conditional', 'lte IE 9');
wp_enqueue_script('html5-shiv-script');
if (is_singular() && get_option('thread_comments')) {
wp_enqueue_script('comment-reply');
}
wp_enqueue_script('bootstrap-script');
wp_enqueue_script('main-script', get_template_directory_uri() . '/js/main.js', array('jquery'), $themeVersion, true);
wp_enqueue_style('bootstrap-basic-style', get_stylesheet_uri(), array(), $themeVersion);
// move jquery to bottom ( https://wordpress.stackexchange.com/a/225936/41315 )
$wp_scripts->add_data('jquery', 'group', 1);
$wp_scripts->add_data('jquery-core', 'group', 1);
$wp_scripts->add_data('jquery-migrate', 'group', 1);
}// bootstrapBasicEnqueueScripts
}
add_action('wp_enqueue_scripts', 'bootstrapBasicEnqueueScripts');
/**
* admin page displaying help.
*/
if (is_admin()) {
require get_template_directory() . '/inc/BootstrapBasicAdminHelp.php';
$bbsc_adminhelp = new BootstrapBasicAdminHelp();
add_action('admin_menu', array($bbsc_adminhelp, 'themeHelpMenu'));
unset($bbsc_adminhelp);
}
/**
* Make WordPress 5 (Gutenberg) editor support Bootstrap CSS.
*/
require_once get_template_directory() . '/inc/BootstrapBasicWp5.php';
$BbWp5 = new BootstrapBasicWp5();
unset($BbWp5);
/**
* 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';
/**
* Custom dropdown menu and navbar in walker class
*/
require get_template_directory() . '/inc/BootstrapBasicMyWalkerNavMenu.php';
/**
* Template functions
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* --------------------------------------------------------------
* Theme widget & widget hooks
* --------------------------------------------------------------
*/
require get_template_directory() . '/inc/widgets/BootstrapBasicAutoRegisterWidgets.php';
$BootstrapBasicAutoRegisterWidgets = new BootstrapBasicAutoRegisterWidgets();
$BootstrapBasicAutoRegisterWidgets->registerAll();
unset($BootstrapBasicAutoRegisterWidgets);
require get_template_directory() . '/inc/template-widgets-hook.php';