Change Sidebar into Pannels

Hi,

I would like to modify the sidebar. So that the elements are not in a “well” but individually in a “panel”.
How do I get this?

Greetings Mario

Hi,

I found a tutorial: Adding Bootstrap Panel Classes to Widgets

So my function now looks like this:

function sparkling_widgets_init() {
  register_sidebar( array(
    'name'          => esc_html__( 'Sidebar', 'sparkling' ),
    'id'            => 'sidebar-1',
    'before_widget' => '<aside id="%1$s" class="widget %2$s panel panel-default">',
    'after_widget'  => '</div></aside>',
    'before_title'  => '<div class="panel-heading"><h3 class="widget-title panel-title">',
    'after_title'   => '</h3></div><div class="panel-body">',
  ));
}
add_action( 'widgets_init', 'sparkling_widgets_init' );

So far so good, but now I get a white page. Can somebody give my a hint to fix this?

Hi Mario,

I hope you are well today and thanks for posting here.

Have you made the changes in the Sparkling theme files?

If you are getting white screen then can you please try temporary enabling WP_DEBUG mode? To do this, just go to wp-config.php include this:

define('WP_DEBUG',true);

You might already have a line for WP_DEBUG, so just make sure it’s set to true.

Let me know what errors if any you are getting when you face this issue so that we can resolve it.

Kind Regards,
Movin

Hi Movin,

I enabled Debug-Mode, but no Error in the Console. I enabled this three things:

define('WP_DEBUG', true );
define( 'WP_DEBUG_DISPLAY', true );
define( 'WP_DEBUG_LOG', true);

Nothing has changed.

I’m using the sparkling-child theme. Here are the files with my changes.

Hi Mario,

In your shared code you have set WP_DEBUG_LOG to true that causes all errors to also be saved to a debug.log log file inside the /wp-content/ directory.

Have you checked the debug file or just try removing the following code from your shared code.

define( 'WP_DEBUG_LOG', true);

I used your shared child theme on my test site and faced the same issue that you are facing so i troubleshooted the issue and resolved it in the child theme that occurred with the function sparkling_widgets_init.

I shared you the updated child theme by attaching it to this reply so please use it on your site by deleting your existing child theme.

Best Regards,
Movin

Hi Movin,

thanks for help.

Greetings Mario

You are most welcome here :slight_smile: