Home Forums WoodMart support forum Changing the default "H" value for the title section Reply To: Changing the default "H" value for the title section

#35038

Artem Temos
Keymaster

Copy this code to the function.php in the child theme and edit

	function woodmart_widget_init() {
		if( function_exists( 'register_sidebar' ) ) {
			$widget_class = ( woodmart_get_opt( 'widget_toggle' ) ) ? ' widget-hidable' : '';

			if( woodmart_get_opt( 'full_screen_menu' ) ) {
				register_sidebar(
					array(
						'name'          => esc_html__( 'Full Screen Menu Area', 'woodmart' ),
						'id'            => 'sidebar-full-screen-menu',
						'description'   => esc_html__( 'Widget Area for full screen menu', 'woodmart' ),
						'class'         => '',
						'before_widget' => '<div id="%1$s" class="woodmart-widget full-screen-menu-widget' . $widget_class . ' %2$s">',
						'after_widget'  => '</div>',
						'before_title'  => '<h5 class="widget-title">',
						'after_title'   => '</h5>'
					)
				);
			}

			register_sidebar( 
				array(
					'name'          => esc_html__( 'Main Widget Area', 'woodmart' ),
					'id'            => 'sidebar-1',
					'description'   => esc_html__( 'Default Widget Area for posts and pages', 'woodmart' ),
					'class'         => '',
					'before_widget' => '<div id="%1$s" class="woodmart-widget sidebar-widget' . $widget_class . ' %2$s">',
					'after_widget'  => '</div>',
					'before_title'  => '<h5 class="widget-title">',
					'after_title'   => '</h5>'
				)
			);
			if( woodmart_woocommerce_installed() ) {

				$filter_widget_class = woodmart_get_widget_column_class( 'filters-area' );

				register_sidebar( 
					array(
						'name'          => esc_html__( 'Shop page Widget Area', 'woodmart' ),
						'id'            => 'sidebar-shop',
						'description'   => esc_html__( 'Widget Area for shop pages', 'woodmart' ),
						'class'         => '',
						'before_widget' => '<div id="%1$s" class="woodmart-widget sidebar-widget' . $widget_class . ' %2$s">',
						'after_widget'  => '</div>',
						'before_title'  => '<h5 class="widget-title">',
						'after_title'   => '</h5>'
					)
				);
				register_sidebar( 
					array(
						'name'          => esc_html__( 'Shop filters', 'woodmart' ),
						'id'            => 'filters-area',
						'description'   => esc_html__( 'Widget Area for shop filters above the products', 'woodmart' ),
						'class'         => '',
						'before_widget' => '<div id="%1$s" class="woodmart-widget filter-widget' . $widget_class . ' ' . esc_attr( $filter_widget_class ) . ' %2$s">',
						'after_widget'  => '</div>',
						'before_title'  => '<h5 class="widget-title">',
						'after_title'   => '</h5>'
					)
				);
				register_sidebar( 
					array(
						'name'          => esc_html__( 'Single product page Widget Area', 'woodmart' ),
						'id'            => 'sidebar-product-single',
						'description'   => esc_html__( 'Widget Area for single product page', 'woodmart' ),
						'class'         => '',
						'before_widget' => '<div id="%1$s" class="woodmart-widget sidebar-widget' . $widget_class . ' %2$s">',
						'after_widget'  => '</div>',
						'before_title'  => '<h5 class="widget-title">',
						'after_title'   => '</h5>'
					)
				);
				
				register_sidebar( 
					array(
						'name'          => esc_html__( 'My Account pages sidebar', 'woodmart' ),
						'id'            => 'sidebar-my-account',
						'description'   => esc_html__( 'Widget Area for My Account, orders and other user pages.', 'woodmart' ),
						'class'         => '',
						'before_widget' => '<div id="%1$s" class="woodmart-widget sidebar-widget' . $widget_class . ' widget-my-account %2$s">',
						'after_widget'  => '</div>',
						'before_title'  => '<h5 class="widget-title">',
						'after_title'   => '</h5>'
					)
				);
			}

			register_sidebar( 
				array(
					'name'          => esc_html__( 'Widget Area in the header', 'woodmart' ),
					'id'            => 'header-widgets',
					'description'   => esc_html__( 'Widget Area for some header types. Will be displayed if "Text in the header" field is empty in Theme Options', 'woodmart' ),
					'class'         => '',
					'before_widget' => '<div id="%1$s" class="woodmart-widget header-widget %2$s">',
					'after_widget'  => '</div>',
					'before_title'  => '<h5 class="widget-title">',
					'after_title'   => '</h5>'
				)
			);

			register_sidebar( 
				array(
					'name'          => esc_html__( 'Area after the mobile menu', 'woodmart' ),
					'id'            => 'mobile-menu-widgets',
					'description'   => esc_html__( 'Place your widgets that will be displayed after the mobile menu links', 'woodmart' ),
					'class'         => '',
					'before_widget' => '<div id="%1$s" class="woodmart-widget mobile-menu-widget %2$s">',
					'after_widget'  => '</div>',
					'before_title'  => '<h5 class="widget-title">',
					'after_title'   => '</h5>'
				)
			);

			$footer_layout = woodmart_get_opt( 'footer-layout' );

			$footer_config = woodmart_get_footer_config( $footer_layout );

			if( count( $footer_config['cols'] ) > 0 ) {
				foreach ( $footer_config['cols'] as $key => $columns ) {
					$index = $key + 1;
					register_sidebar( 
						array(
							'name'          => 'Footer Column ' . $index,
							'id'            => 'footer-'.$index,
							'description'   => 'Footer column',
							'class'         => '',
							'before_widget' => '<div id="%1$s" class="woodmart-widget footer-widget %2$s">',
							'after_widget'  => '</div>',
							'before_title'  => '<h5 class="widget-title">',
							'after_title'   => '</h5>'
						)
					);
				}
			}

			$custom_sidebars = get_posts( array('post_type' => 'woodmart_sidebar', 'post_status'=>'publish') );
			
			foreach ( $custom_sidebars as $sidebar ) {
				register_sidebar( 
					array(
						'name'          => $sidebar->post_title,
						'id'            => 'sidebar-' . $sidebar->ID,
						'description'   => '',
						'class'         => '',
						'before_widget' => '<div id="%1$s" class="woodmart-widget sidebar-widget %2$s">',
						'after_widget'  => '</div>',
						'before_title'  => '<h5 class="widget-title">',
						'after_title'   => '</h5>'
					)
				);
			}
		}
	}

	add_action( 'widgets_init', 'woodmart_widget_init' );