A A A
Forum Scope


Match



Forum Options



Min search length: 3 characters / Max search length: 84 characters
Forum Login
Lost password?
plugins-topic
Basic instructions for how to enqueue Bootstrap library first
Avatar
Silvia Di Blasio

11 Posts
(Offline)
1
May 22, 2018 - 9:13 pm
Print

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

19448 Posts
(Offline)
2
May 23, 2018 - 1:16 am
Print

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…

sp_Check
This post answers the topic
Avatar
Silvia Di Blasio

11 Posts
(Offline)
3
May 24, 2018 - 3:26 pm
Print

Thank you, this is very helpful. 

Avatar
Mr Papa
Simi Valley, CA

19448 Posts
(Offline)
4
May 24, 2018 - 3:39 pm
Print

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

Forum Timezone: America/New_York
All RSSShow Stats
Administrators: Blues Dancer, Simple Press, SP Community Support
Top Posters:
Mr Papa: 19448
Ike: 2086
Brandon: 864
kvr28: 804
jim: 630
FidoSysop: 577
Conrad_Farlow: 531
fiddlerman: 358
Stefano Prete: 325
Newest Members:
David Hnát
Gary Lee
Glen Stewart
Rodney Pacis
kent black
Robert Meharg
test test
narek amprachamian
Forum Stats:
Groups: 7
Forums: 17
Topics: 10065
Posts: 79362

 

Member Stats:
Guest Posters: 607
Members: 16923
Moderators: 0
Admins: 3

Most Users Ever Online
499
Currently Online
Guest(s)
11
Currently Browsing this Page

1 Guest(s)