Roots Discourse

Sage 10 Child theme - Bootstrap 5 scripts are called twice. Now nav toggles doesn't work

Hey all,

Today I’ve installed BS5 to my theme and child theme. But now I notice my navbar toggles opens but cannot close the navbar. The .show class is not beeing removed. Alright, so I’ve got a feeling this is because might be called twice. It’s loaded in both themes. (right?)

When I activate the parent theme it works fine. When I activate the child theme it breaks. Now, I’ve tried removing BS5 from the child theme’s package.json and the child theme assets. But then it doesn’t even open.

How to handle this correctly?

Solved.

both parent and child theme call the /app/setup.php, which in each case enqeues the css and js files twice. (even though one of each shows up in the head).

I’ve noticed a simple console.log("hello world"); was rendered twice.
So in the parent setup.php I’ve added:

if(get_template_directory() === get_stylesheet_directory()) {  
   add_action('wp_enqueue_scripts', function () {
      // stuff here
   });
}

Don’t know the exacts, but now it works again.

This topic was automatically closed after 42 days. New replies are no longer allowed.