Skip to content

Instantly share code, notes, and snippets.

@carlosonweb
Created June 7, 2019 03:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save carlosonweb/b32f8dbc868853049430efef55dff783 to your computer and use it in GitHub Desktop.
Save carlosonweb/b32f8dbc868853049430efef55dff783 to your computer and use it in GitHub Desktop.
BB Ticket 82857 -- Change Widget Title Hx Tag (Default tag in the BB Parent Theme is h4)
<?php
/**
* Helper class for child theme functions.
*
* @class FLChildTheme
*/
final class FLChildTheme {
/**
* Enqueues scripts and styles.
*
* @return void
*/
static public function enqueue_scripts(){
$ver = wp_get_theme()->get( 'Version' );
wp_enqueue_style( 'fl-child-theme', FL_CHILD_THEME_URL . '/style.css', array(), $ver );
wp_dequeue_script( 'fl-automator' );
wp_enqueue_script( 'fl-child-theme', FL_CHILD_THEME_URL . '/js/theme.js', array(), $ver );
}
static public function get_setting( $key = '', $default = '' ) {
$settings = FLCustomizer::get_mods();
$setting = '';
if ( isset( $settings[ $key ] ) ) {
$setting = $settings[ $key ];
} else {
$setting = $default;
}
return apply_filters( 'fl_theme_get_setting_' . $key, $setting, $default, $settings );
}
static public function is_plugin_active( $slug ) {
if ( ! function_exists( 'is_plugin_active' ) ) {
include_once( ABSPATH . 'wp-admin/includes/plugin.php' );
}
return is_plugin_active( $slug . '/' . $slug . '.php' );
}
static public function widgets_init() {
$footer_widgets_display = self::get_setting( 'fl-footer-widgets-display' );
$woo_layout = self::get_setting( 'fl-woo-layout' );
// Primary Sidebar
register_sidebar(array(
'name' => __( 'Primary Sidebar', 'fl-automator' ),
'id' => 'blog-sidebar',
'before_widget' => '<aside id="%1$s" class="fl-widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h3 class="fl-widget-title">',
'after_title' => '</h3>',
));
// Footer Widgets
if ( 'disabled' != $footer_widgets_display ) {
register_sidebars( 4, array(
/* translators: %d: order number of the auto-created sidebar */
'name' => _x( 'Footer Column %d', 'Sidebar title. %d stands for the order number of the auto-created sidebar, 4 in total.', 'fl-automator' ),
'id' => 'footer-col',
'before_widget' => '<aside id="%1$s" class="fl-widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h4 class="fl-widget-title">',
'after_title' => '</h4>',
) );
}
// WooCommerce Sidebar
if ( 'no-sidebar' != $woo_layout && self::is_plugin_active( 'woocommerce' ) ) {
register_sidebar( array(
'name' => __( 'WooCommerce Sidebar', 'fl-automator' ),
'id' => 'woo-sidebar',
'before_widget' => '<aside id="%1$s" class="fl-widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h4 class="fl-widget-title">',
'after_title' => '</h4>',
) );
}
// After Post Widget
register_sidebar( array(
'name' => __( 'After Post Widget', 'fl-automator' ),
'id' => 'after-post-widget',
'before_widget' => '<aside id="%1$s" class="fl-widget %2$s">',
'after_widget' => '</aside>',
'before_title' => '<h4 class="fl-widget-title">',
'after_title' => '</h4>',
) );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment