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' );
add_image_size( 'featured-thumb', 720, 480, true );
// This theme uses wp_nav_menu() in one location.
register_nav_menus( array(
'primary' => esc_html__( 'Header Menu', 'befold' ),
'footer_menu' => __( 'Footer Menu', 'befold' ),
) );
// Setup the WordPress core custom background feature.
add_theme_support( 'custom-background', apply_filters( 'befold_custom_background_args', array(
'default-color' => '#18191b',
'default-image' => '',
) ) );
/*
* Switch default core markup for search form, comment form, and comments
* to output valid HTML5.
*/
add_theme_support( 'html5', array(
'comment-list',
'comment-form',
'search-form',
'gallery',
'caption'
) );
/*
* Enable support for Post Formats.
* See https://developer.wordpress.org/themes/functionality/post-formats/
*/
add_theme_support( 'post-formats', array(
'image'
) );
$header_bg = array(
'default-image' => get_template_directory_uri() . '/images/header_bg.jpg',
'width' => 1500,
'height' => 500,
'flex-height' => true,
'flex-width' => true
);
$logo = array(
'height' => 240,
'width' => 240,
'flex-height' => true
);
add_theme_support( 'wp-block-styles' );
add_theme_support( 'responsive-embeds' );
add_theme_support( 'align-wide' );
add_theme_support( 'custom-background' );
add_theme_support( 'custom-header',$header_bg);
add_theme_support( 'custom-logo',$logo);
remove_theme_support( 'widgets-block-editor' );
}
endif; // befold_setup
add_action( 'after_setup_theme', 'befold_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 befold_content_width() {
$GLOBALS['content_width'] = apply_filters( 'befold_content_width', 1140 );
}
add_action( 'after_setup_theme', 'befold_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function befold_widgets_init() {
register_sidebar( array(
'name' => esc_html__( 'Sidebar', 'befold' ),
'id' => 'sidebar-right',
'description' => '',
'before_widget' => '',
'before_title' => '
',
) );
}
add_action( 'widgets_init', 'befold_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function befold_scripts() {
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/plugins/css/bootstrap.min.css', array(), '3.3.6' );
wp_enqueue_style( 'font-awesome', get_template_directory_uri() . '/assets/plugins/css/font.awesome.min.css', array(), '4.5.0' );
wp_enqueue_style( 'gutenberg-css-1', get_template_directory_uri() . '/assets/admin/css/gutenberg-style.css', array(), '3.3.6' );
wp_enqueue_style( 'befold', get_stylesheet_uri() );
wp_enqueue_style( 'befold-editor', get_template_directory_uri() . '/assets/admin/css/custom.css', array(), befold_get_version() );
wp_enqueue_style( 'befold-responsive', get_template_directory_uri() . '/assets/css/responsive.css', array(), befold_get_version(), true );
wp_enqueue_script( 'jRespond', get_template_directory_uri() . '/assets/plugins/js/jrespond.min.js', array(), '0.10', true );
wp_enqueue_script( 'jquery-easing', get_template_directory_uri() . '/assets/plugins/js/jquery.easing.min.js', array(), '1.3.2', true );
wp_enqueue_script( 'befold-app', get_template_directory_uri() . '/assets/js/app.js', array( 'jquery' ), befold_get_version(), true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
// Custom Background Add Inline Style Start
wp_enqueue_style( 'custom-style', get_template_directory_uri() . '/assets/plugins/css/custom-inline.css', array(), '1.0', true );
global $redux_demo;
$bg_custom_css ='';
$bg_custom_css_image_url ='';
$bg_custom_css_image_pos ='';
$bg_custom_blog_bg_color ='';
$blog_background = $redux_demo['blog_page_header_bg']??'';
if(!empty($bg_custom_css['background-image']) || !empty($bg_custom_css['background-position'])){
$bg_custom_css_image_url = $bg_custom_css['background-image']??'';
$bg_custom_css_image_pos = $bg_custom_css['background-position']??'';
}
$bg_custom_blog_image_url = '';
$bg_custom_blog_image_pos = '';
if(!empty($blog_background['image']) || !empty($blog_background['background-image']) || !empty($blog_background['background-position'])|| !empty($blog_background['background-color'])){
$bg_custom_blog_bg_image_url = $blog_background['background-image']?? $blog_background['image'];
$bg_custom_blog_image_pos = $blog_background['background-position']?? $blog_background['position'];
$bg_custom_blog_bg_color = $blog_background['background-color']??'';
if( empty($bg_custom_blog_image_url['background-image'])){
$bg_custom_blog_image_url = get_template_directory_uri() . '/images/header_bg.jpg';
}
$start = strpos($bg_custom_blog_image_pos,"-");
if($start > 0){
$blog_bg_position = substr_replace($bg_custom_blog_image_pos,' ',$start);
}else{
$blog_bg_position = $bg_custom_blog_image_pos;
}
}
$custom_css="";
// Banner on blog page css
if(!empty($blog_bg_position) && !empty($bg_custom_blog_bg_image_url) ){
$custom_css .='.page-header{
background-image:url("'.$bg_custom_blog_bg_image_url.'");
background-position: '.$blog_bg_position.';
}';
}elseif(!empty($bg_custom_blog_bg_image_url) && !empty($bg_custom_blog_bg_color)){
$custom_css .='.page-header{
background-image:url("'.$bg_custom_blog_bg_image_url.'");
background-position: '.$blog_bg_position.';
}';
}else{
$custom_css .='.page-header{
background-color:'.$bg_custom_blog_bg_color.';}';
}
// Banner on blog page css end
wp_add_inline_style( 'custom-style', $custom_css );
// Custom Background Add Inline Style End
}
add_action( 'wp_enqueue_scripts', 'befold_scripts' );
function befold_admin_styles() {
$add_theme_slug = 'befold_';
wp_enqueue_style( $add_theme_slug .'redux-custom', get_template_directory_uri() . '/assets/admin/css/redux-demo-style.css', false, '1.0.0' );
wp_enqueue_style( $add_theme_slug .'custom_block', get_template_directory_uri() . '/assets/admin/css/custom.css', false, '1.0.0' );
}
add_action( 'admin_enqueue_scripts', 'befold_admin_styles' );
/**
* Include the TGM_Plugin_Activation class.
*/
require_once get_template_directory() . '/inc/tgmpa/tgm-plugin-activation.php';
/**
* Custom template tags for this theme.
*/
require_once get_template_directory() . '/inc/admin/options-init.php';
require get_template_directory() . '/inc/template-tags.php';
/**
* Comments Callback.
*/
require_once get_template_directory() . '/inc/comments-callback.php';
/**
* Add breadcrumb.
*/
require_once get_template_directory() . '/inc/breadcrumb.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Custom Funtion Files
*/
// Block Styles.
require get_template_directory() . '/inc/functions/block-patterns.php';
require get_template_directory() . '/inc/functions/block-styles.php';
if ( ! function_exists( 'befold_post_navigation' ) ) :
/**
* Display navigation to next/previous post when applicable.
*/
function befold_post_navigation() {
// Don't print empty markup if there's nowhere to navigate.
$previous = ( is_attachment() ) ? get_post( get_post()->post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous ) {
return;
}
?>