tag in the document head, and expect WordPress to
* provide it for us.
*/
add_theme_support( 'title-tag' );
/*
* Enable support for Post Thumbnails on posts and pages.
*
* @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
*/
add_theme_support( 'post-thumbnails' );
/*
* This function id used for Logo upload.
*/
add_theme_support( 'custom-logo' );
/*
* This theme uses wp_nav_menu() in one location.
* This menu is used only for Front Page.
*/
register_nav_menus( array(
'primary' => esc_html__( 'Primary Menu', 'bfront' ),
) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'search-form',
'comment-form',
'comment-list',
'gallery',
'caption',
) );
add_image_size( 'bfront-large', 720, 9999 );
add_image_size( 'bfront-medium', 575, 9999 );
//Set up the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'bfront_custom_background_args', array(
'default-color' => 'ffffff',
'default-image' => '',
) ) );
}
endif;
add_action( 'after_setup_theme', 'bfront_setup' );
/**
* Set the content width in pixels, based on the theme's design and stylesheet.
*
* Priority 0 to make it available to lower priority callbacks.
*
* @global int $content_width
*/
function bfront_content_width() {
$GLOBALS['content_width'] = apply_filters( 'bfront_content_width', 640 );
}
add_action( 'after_setup_theme', 'bfront_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function bfront_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'bfront' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'bfront' ),
'before_widget' => '
',
'before_title' => '',
) );
// First Footer Widget
register_sidebar( array(
'name' => esc_html__( 'First Footer Widget', 'bfront' ),
'id' => 'first-footer-widget',
'description' => esc_html__( 'Add widgets here.', 'bfront' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
// Second Footer Widget
register_sidebar( array(
'name' => esc_html__( 'Second Footer Widget', 'bfront' ),
'id' => 'second-footer-widget',
'description' => esc_html__( 'Add widgets here.', 'bfront' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
// Third Footer Widget
register_sidebar( array(
'name' => esc_html__( 'Third Footer Widget', 'bfront' ),
'id' => 'third-footer-widget',
'description' => esc_html__( 'Add widgets here.', 'bfront' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
// Fourth Footer Widget
register_sidebar( array(
'name' => esc_html__( 'Fourth Footer Widget', 'bfront' ),
'id' => 'fourth-footer-widget',
'description' => esc_html__( 'Add widgets here.', 'bfront' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
) );
}
add_action( 'widgets_init', 'bfront_widgets_init' );
/**
* Enqueue styles.
*/
function bfront_styles() {
wp_enqueue_style('bfront-font-Monda', '//fonts.googleapis.com/css?family=Monda:400,700');
wp_enqueue_style('bfront-Reset-css', get_template_directory_uri() . '/css/reset.css');
wp_enqueue_style('bfront-flexslider-css', get_template_directory_uri() . '/css/flexslider.css');
wp_enqueue_style('bfront-font-awesome-css', get_template_directory_uri() . '/css/font-awesome.css');
wp_enqueue_style('bfront-bootstrap-css', get_template_directory_uri() . '/css/bootstrap.css');
wp_enqueue_style('bfront-superfish-css', get_template_directory_uri() . '/css/superfish.css');
wp_enqueue_style('bfront-animate-css', get_template_directory_uri() . '/css/animate.css');
wp_enqueue_style('bfront-style', get_stylesheet_uri() );
}
add_action( 'wp_enqueue_scripts', 'bfront_styles' );
/**
* Enqueue scripts.
*/
function bfront_scripts() {
wp_enqueue_script('jquery');
wp_enqueue_script('bfront-flexslider', get_template_directory_uri() . '/js/jquery.flexslider.js', array('jquery'));
wp_enqueue_script('bfront-superfish', get_template_directory_uri() . '/js/superfish.js', array('jquery'));
wp_enqueue_script('bfront-bootstrap', get_template_directory_uri() . '/js/bootstrap.js', array('jquery'));
wp_enqueue_script('bfront-custom', get_template_directory_uri() . '/js/custom.js', array('jquery'));
wp_enqueue_script('bfront-wow', get_template_directory_uri() . '/js/wow.js', array('jquery'));
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'bfront_scripts' );
/**
* 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-Customizer additions.
*/
require get_template_directory() . '/inc/custom-customizer.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/define_template.php';
function bfront_get_excerpt($count){
$excerpt = get_the_content();
$excerpt = strip_tags($excerpt);
$excerpt = substr($excerpt, 0, $count);
return $excerpt.'[...]';
}
function bfront_excerpt_length( $length ) {
return 60;
}
add_filter( 'excerpt_length', 'bfront_excerpt_length', 999 );
function bfront_custom_css(){
$custom_css = esc_attr( get_theme_mod('custom_css') );
echo '';
}
add_action('wp_head', 'bfront_custom_css');