Support Forum

Advanced Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
plugins-topic
Basic instructions for how to enqueue Bootstrap library first
Avatar
Silvia Di Blasio
Member
sp_UserOfflineSmall Offline
May 22, 2018 - 9:13 pm

Hi. I am a developer.  I understand the concept that Bootstrap is being loaded in the wrong order somehow, and that you need to enqueue it earlier in the chain (later in the chain?), so things all work out nicely. Through a good bit of post reading, I gleaned all that, but I did not see any post that speaks generally of what the principle is. Step 1... find your bootstrap enqueue call... Step 2... copy that code and put it in an action hook function like so... Etc.

Can you give me a few simple steps? Maybe this will help a lot of people. Or please point me to where that would live.

Thanks!

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 23, 2018 - 1:16 am

its potentially different on theme by theme basis... and bootstrap is not directly supported by wp since it conflicts with the jquery ui it loads...  but many themes 'get away' with it if jquery ui is not used on the front end... none the less, the basic rules is:

make sure bootstrap js file is loaded before the wp jquery ui js file...

sounds simple, right? 😉  usually themes (or plugins) will simply load bootstrap when they want and not worry about wp compatibility...

first thing to check is to see if loading the simple press js in the footer will solve it for you...  if the theme load bootstrap in the header, then loading our stuff in the footer will make it 'after'...  of course, if another plugin (or the theme) loads jquery ui in the header, it wont help... and it may not if bootstrap js is also loaded in the footer... you can make sure the simple press js is loaded in footer by checking the option on forum - integration - page and permalink...

if that doesnt work, you will need to use the standard wp enqueue system to ensure its loaded in the needed order...  as developer, I assume you understand how wp enqueue system works (if not see this)..

another potentially easy fix, when used with loading forum js in footer, is to simply find where the bootstrap js is loaded and ensure that wp loads in the header whether fixed location or using wp enqueue (an option is header or footer load)...  see this post for example...

still another potential easy fix is to disable the forum tooltips (usually only helpful if that the is the portion of bootstrap in use)... this can be done with this example..

the problem here may be how the theme (or plugin) loads bootstrap...  many ignore wp standards and simply load the js instead of enqueueing it...  the second problem will likely be that wp just simply loads jquery ui itself if any plugin/theme adds a dependency for its js on jquery ui (like we do)...  so you may have to deregister the wp jquery ui script and then re-enqueue it with a dependency on the bootstrap js that you will register and enqueue..

if still more is needed, probably best to research your theme and figure our where and how its loading the bootstrap js file and we can try to go from there...

Avatar
Silvia Di Blasio
Member
sp_UserOfflineSmall Offline
May 24, 2018 - 3:26 pm

Thank you, this is very helpful. 

Avatar
Mr Papa
Simi Valley, CA
SP Master
Free Members
sp_UserOfflineSmall Offline
May 24, 2018 - 3:39 pm

Did it get it working for you? Glad to help.. 

Forum Timezone: Europe/Stockholm
Most Users Ever Online: 1170
Currently Online:
Guest(s) 1
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 650
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Member Stats:
Guest Posters: 620
Members: 17365
Moderators: 0
Admins: 4
Forum Stats:
Groups: 7
Forums: 17
Topics: 10128
Posts: 79626