Cannot change header size in register_sidebar function
-
I am starting with WordPress and this is my first post here, I apologize if it is in the wrong section.
I am working on building a theme using namespaces as a starting point. In my functions.php inside my theme I have the function below to register my sidebar.
The original code came with H2’s and I am changing it to H4’s as in the bold text below. When I refresh my browser the size does not change.
The sidebar is getting called from sidebar.php using the dynamic_sidebar function with the correct name. I just can’t get the size of the headings to change. Am I doing something wrong?
Thank you!
function pro_headphones_wp_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar', 'pro-headphones-wp' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'Add widgets here.', 'pro-headphones-wp' ), 'before_widget' => '<section id="%1$s" class="widget %2$s">', 'after_widget' => '</section>', 'before_title' => '<h4 class="widget-title">', 'after_title' => '</h4>', ) ); } add_action( 'widgets_init', 'pro_headphones_wp_widgets_init' );
-
Hi,
Can you check in the chrome developer if the header has really been changed into <h4>. If it is the case, I think it is a CSS problem.
Hi,
I checked and it seems it is still getting the H2 heading size, but I am not sure from where. I add screenshots of the chrome inspect and of the functions.php file where there sidebar is getting registered.
thanks
I tested commenting out the registering of the sidebar and it does remove the bar, changing the name and ID and those changes also show. It is only the heading size that does not change from the register_sidebar() function.
The only way that I was able to change the heading size was through the admin interface in the widgets GUI. That does work, but it is supposed to work from the register_sidebar() function as well right? Maybe I am missing something here…so I found a way to do it, but just want to make sure I get the foundations right 🙂
The topic ‘Cannot change header size in register_sidebar function’ is closed to new replies.