__( 'Right Sidebar', 'bootstrap-four' ),
'id' => 'right-sidebar',
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
) );
}
endif;
add_action( 'widgets_init', 'bootstrap_four_widgets_init' );
if ( ! function_exists( 'bootstrap_four_setup' ) ) :
function bootstrap_four_setup() {
add_theme_support( 'custom-background', array(
'default-color' => 'ffffff',
) );
add_theme_support( 'automatic-feed-links' );
add_theme_support( 'title-tag' );
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
register_nav_menus( array(
'main_menu' => __( 'Main Menu', 'bootstrap-four' ),
// 'footer_menu' => 'Footer Menu'
) );
add_editor_style( 'css/bootstrap.min.css' );
}
endif; // bootstrap_four_setup
add_action( 'after_setup_theme', 'bootstrap_four_setup' );
if ( ! function_exists( 'bootstrap_four_theme_styles' ) ) :
function bootstrap_four_theme_styles() {
global $bootstrap_four_version;
wp_enqueue_style( 'bootstrap-four-font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array(), '4.4.0' );
wp_register_style( 'bootstrap-four-bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), $bootstrap_four_version );
wp_enqueue_style( 'bootstrap-four-styles', get_stylesheet_uri(), array( 'bootstrap-four-bootstrap' ), '1' );
}
endif;
add_action('wp_enqueue_scripts', 'bootstrap_four_theme_styles');
if ( ! function_exists( 'bootstrap_four_theme_scripts' ) ) :
function bootstrap_four_theme_scripts() {
global $bootstrap_four_version;
wp_enqueue_script( 'bootstrap-four-bootstrap', get_template_directory_uri() . '/js/bootstrap.js', array( 'jquery' ), $bootstrap_four_version, true );
}
endif;
add_action('wp_enqueue_scripts', 'bootstrap_four_theme_scripts');
function bootstrap_four_nav_li_class( $classes, $item ) {
$classes[] .= ' nav-item';
return $classes;
}
add_filter( 'nav_menu_css_class', 'bootstrap_four_nav_li_class', 10, 2 );
function bootstrap_four_nav_anchor_class( $atts, $item, $args ) {
$atts['class'] .= ' nav-link';
return $atts;
}
add_filter( 'nav_menu_link_attributes', 'bootstrap_four_nav_anchor_class', 10, 3 );
function bootstrap_four_comment_form_before() {
echo '';
}
add_action( 'comment_form_before', 'bootstrap_four_comment_form_before', 10, 5 );
function bootstrap_four_comment_form( $fields ) {
$fields['fields']['author'] = '
';
$fields['fields']['email'] ='
';
$fields['fields']['url'] = '
';
$fields['comment_field'] = '
';
$fields['comment_notes_before'] = '';
$fields['class_submit'] = 'btn btn-primary';
return $fields;
}
add_filter( 'comment_form_defaults', 'bootstrap_four_comment_form', 10, 5 );
function bootstrap_four_comment_form_after() {
echo ' ';
}
add_action( 'comment_form_after', 'bootstrap_four_comment_form_after', 10, 5 );
/* * * * * * * * * * * * * * *
* BS4 Utility Functions
* * * * * * * * * * * * * * */
function bootstrap_four_get_posts_pagination( $args = '' ) {
global $wp_query;
$pagination = '';
if ( $GLOBALS['wp_query']->max_num_pages > 1 ) :
$defaults = array(
'total' => isset( $wp_query->max_num_pages ) ? $wp_query->max_num_pages : 1,
'current' => get_query_var( 'paged' ) ? intval( get_query_var( 'paged' ) ) : 1,
'type' => 'array',
'prev_text' => '«',
'next_text' => '»',
);
$params = wp_parse_args( $args, $defaults );
$paginate = paginate_links( $params );
if( $paginate ) :
$pagination .= "";
endif;
endif;
return $pagination;
}
function bootstrap_four_the_posts_pagination( $args = '' ) {
echo bootstrap_four_get_posts_pagination( $args );
}