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 theme uses wp_nav_menu() in one location.
register_nav_menus(
array(
'primary' => esc_html__( 'Primary', 'brosil' ),
)
);
/*
* 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',
'style',
'script',
)
);
// Set up the WordPress core custom background feature.
add_theme_support(
'custom-background',
apply_filters(
'brosil_custom_background_args',
array(
'default-color' => 'ffffff',
'default-image' => '',
)
)
);
// Add theme support for selective refresh for widgets.
add_theme_support( 'customize-selective-refresh-widgets' );
/**
* Add support for core custom logo.
*
* @link https://codex.wordpress.org/Theme_Logo
*/
add_theme_support(
'custom-logo',
array(
'height' => 250,
'width' => 250,
'flex-width' => true,
'flex-height' => true,
)
);
}
endif;
add_action( 'after_setup_theme', 'brosil_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 brosil_content_width() {
// This variable is intended to be overruled from themes.
// Open WPCS issue: {@link https://github.com/WordPress-Coding-Standards/WordPress-Coding-Standards/issues/1043}.
// phpcs:ignore WordPress.NamingConventions.PrefixAllGlobals.NonPrefixedVariableFound
$GLOBALS['content_width'] = apply_filters( 'brosil_content_width', 640 );
}
add_action( 'after_setup_theme', 'brosil_content_width', 0 );
/**
* Register widget area.
*
* @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
*/
function brosil_widgets_init() {
register_sidebar(
array(
'name' => esc_html__( 'Sidebar', 'brosil' ),
'id' => 'sidebar-1',
'description' => esc_html__( 'Add widgets here.', 'brosil' ),
'before_widget' => '
',
'after_widget' => '
',
'before_title' => '',
'after_title' => '
',
)
);
register_sidebar( array(
'name' => esc_html__( 'Footer Colum 1', 'brosil' ),
'id' => 'footer-1',
'description' => esc_html__( 'Add widgets here.', 'brosil' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Colum 2', 'brosil' ),
'id' => 'footer-2',
'description' => esc_html__( 'Add widgets here.', 'brosil' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Colum 3', 'brosil' ),
'id' => 'footer-3',
'description' => esc_html__( 'Add widgets here.', 'brosil' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => esc_html__( 'Footer Copyright', 'brosil' ),
'id' => 'footer-copyright',
'description' => esc_html__( 'Add widgets here.', 'brosil' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
}
add_action( 'widgets_init', 'brosil_widgets_init' );
/**
* Enqueue scripts and styles.
*/
function brosil_fonts_url() {
$fonts_url = '';
$poppins = _x( 'on', 'Poppins font: on or off', 'brosil' );
$open_sans = _x( 'on', 'Open Sans font: on or off', 'brosil' );
if ( 'off' !== $poppins || 'off' !== $open_sans ) {
$font_families = array();
if ( 'off' !== $poppins ) {
$font_families[] = 'Poppins:100,200,300,400,400i,500,600,700,800,900';
}
if ( 'off' !== $open_sans ) {
$font_families[] = 'Open Sans:300,400,400i,600,700,800';
}
$query_args = array(
'family' => urlencode( implode( '|', $font_families ) ),
'subset' => urlencode( 'latin,latin-ext' ),
);
$fonts_url = add_query_arg( $query_args, 'https://fonts.googleapis.com/css' );
}
return esc_url_raw( $fonts_url );
}
function brosil_scripts() {
wp_enqueue_style( 'brosil-fonts', brosil_fonts_url(), array(), null );
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css' );
wp_enqueue_style( 'icofont', get_template_directory_uri() . '/assets/css/icofont.css' );
wp_enqueue_style( 'fontawesome', get_template_directory_uri() . '/assets/css/fontawesome.min.css');
wp_enqueue_style( 'brosil-style', get_stylesheet_uri(), array(), _S_VERSION );
wp_enqueue_style( 'nice-select', get_template_directory_uri() . '/assets/css/nice-select.css' );
wp_enqueue_style( 'responsive', get_template_directory_uri() . '/assets/css/responsive.css' );
wp_enqueue_script( 'bootstrap', get_template_directory_uri() . '/assets/js/bootstrap.min.js', array('jquery'), '1.0', true );
wp_enqueue_script( 'isotope', get_template_directory_uri() . '/assets/js/jquery.isotope.min.js', array('jquery'), '1.0', true );
wp_enqueue_script( 'niceselect', get_template_directory_uri() . '/assets/js/nice-select.min.js', array('jquery'), '1.0', true );
wp_enqueue_script( 'main', get_template_directory_uri() . '/assets/js/main.js', array('jquery'), '1.0', true );
wp_enqueue_script( 'brosil-navigation', get_template_directory_uri() . '/assets/js/navigation.js', array(), _S_VERSION, true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'wp_enqueue_scripts', 'brosil_scripts' );
/**
* Walker Class
*/
require get_template_directory() . '/inc/wp_menu.php';
/**
* Implement the Custom Header feature.
*/
require get_template_directory() . '/inc/custom-header.php';
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Functions which enhance the theme by hooking into WordPress.
*/
require get_template_directory() . '/inc/template-functions.php';
/**
* Customizer additions.
*/
require get_template_directory() . '/inc/customizer.php';
/**
* Breadcrumbs
*/
require get_template_directory() . '/inc/breadcrumbs.php';
/**
* Theme Options
*/
require get_template_directory() . '/inc/theme-options.php';
/**
* TGM Setup.
*/
require_once(get_template_directory()."/inc/tgm.php");
/**
* Demo Import
*/
require get_template_directory() . '/inc/demo-import/demo-import.php';
/**********************************
## ALLOWED HTML TAGS
/**********************************/
if (!function_exists('brosil_allowed_html')) {
function brosil_allowed_html()
{
$allowed_tags = array(
'a' => array(
'class' => array(),
'href' => array(),
'rel' => array(),
'title' => array(),
'target' => array()
),
'abbr' => array(
'title' => array()
),
'address' => array(),
'iframe' => array(
'src' => array(),
'frameborder' => array(),
'allowfullscreen' => array(),
'allow' => array(),
'width' => array(),
'height' => array(),
),
'b' => array(),
'br' => array(),
'blockquote' => array(
'cite' => array()
),
'cite' => array(
'title' => array()
),
'code' => array(),
'del' => array(
'datetime' => array(),
'title' => array()
),
'dd' => array(),
'div' => array(
'class' => array(),
'id' => array(),
'title' => array(),
'style' => array()
),
'dl' => array(),
'dt' => array(),
'em' => array(),
'h1' => array(
'class' => array()
),
'h2' => array(
'class' => array()
),
'h3' => array(
'class' => array()
),
'h4' => array(
'class' => array()
),
'h5' => array(
'class' => array()
),
'h6' => array(
'class' => array()
),
'i' => array(
'class' => array()
),
'img' => array(
'alt' => array(),
'class' => array(),
'width' => array(),
'height' => array(),
'src' => array(),
'srcset' => array(),
'sizes' => array()
),
'li' => array(
'class' => array()
),
'ol' => array(
'class' => array()
),
'p' => array(
'class' => array()
),
'q' => array(
'cite' => array(),
'title' => array()
),
'span' => array(
'class' => array(),
'title' => array(),
'style' => array()
),
'strike' => array(),
'strong' => array(),
'ul' => array(
'class' => array()
)
);
return $allowed_tags;
}
}
function brosil_add_editor_styles() {
add_editor_style( 'assets/css/custom-editor-style.css' );
}
add_action( 'admin_init', 'brosil_add_editor_styles' );