/**
* Enqueue stylesheet before others
*/
class EnqueueStylesheetEarly {
function __construct() {
add_action( 'wp_enqueue_scripts', [ $this, 'load_before_other_stylesheets' ], 5 );
}
/**
* Register and enqueue stylesheet
*/
function load_before_other_stylesheets() {
wp_register_style(
'bootstrap-css',
plugin_dir_url( __FILE__ ) . 'bootstrap.min.css',
[],
'3.3.7'
);
wp_enqueue_style( 'bootstrap-css' );
}
}
Then you can load this with your other frontend classes in your ‘plugin.php’ Like so…
if ( ! is_admin() ) {
require 'class-enqueue-stylesheet-early.php';
}
At a 5 priority, this should solve your problem. The only thing that usually loads before this is WordPress SEO JSON-LD scripts and meta.
Related Posts:
- Should I use RIPS tool to test my themes and plugins?
- Workflow and best practice for documentation [closed]
- How to get current post user id
- Redirect to another page using contact form 7? [closed]
- How do I combine a theme with a plugin
- How to write “alt” tag in image for wordpress code?
- Don’t load the theme for a page FROM a plugin EDITED
- Extending a theme: build new features as plugin or core modules?
- How do you create a re-useable HTML fragment in wordpress
- How to override any plugin file in the child theme
- when i activate my WordPress plugin cannot see customizer options or preview
- Why the output of an image gallery plugin is not displayed into a page of my custom theme?
- Breadcrumb is not generating the correct post page url
- Site is setup statically – how to make it content managable?
- How to escape html code?
- How to make content as required in custom post type?
- How to create new title and its description inside a section in WP Customizer?
- How do I cleanly override a plugin’s CSS with a child theme?
- What is the correct way for a theme to support plugin UIs?
- How to call “page specific menu items” in template [closed]
- Using standard backend elements in Plugin
- Update Multiple Post Meta for the Same Post In One call?
- Function to activate WordPress theme inside a plugin
- Which functions in theme or plugin load first
- How do I make my wordpress page more friendly for mobile viewers?
- Add CSS animation as Preloader to WordPress
- How to make my plugin theme-independent?
- How to load a new template page according to a particular URL?
- Check javascript file Proper way in functions.php
- Make the css of the widget overwrite theme css
- How to Build a Movie Library in WordPress 3.x
- How do I register a stylesheet inside a WordPress widget?
- Autoload via composer in plugin interference
- Is there a quick way to inject i18n domain into theme/plugin files?
- Unable to load stylesheets and scripts to plugin settings page
- Display future posts?
- Override the core function locate_template
- Having separate plugins and themes folder for multi-site setup
- How can I get full attachment url from wp_get_attachment_metadata?
- Translating plugin inside the theme [closed]
- unzip a folder on specific location and delete the zip file
- gallery option is not available in media upload box in costum theme option page
- Why are some of my thumbnails not being generated?
- Why is the Settings API is not saving my array of options
- Include Max mega menu Plugin into theme
- How to integrate plugin in WordPress theme
- add_action in functions.php, do_action in plugin?
- How do I write into a file (css)
- wordpress theme backend admin only
- ‘Customize’ button in admin bar for CSS
- WooCommerce get_price returning wrong price when used via ajax
- Open Post Thumbnail in New Child Theme File in WordPress
- How to use get_theme_mod in gutenberg editor wordpress?
- Reusable functions and tools (Framework)
- Different UI in WordPress
- plugin style conflicts, how to override? [closed]
- The problem with WordPress Importer
- How to disable CSS rule in Twentythirteen style.css?
- Globally register styles but enqueue them selectively
- Display post lists in 2nd paragraph
- Plugin-generated pages use Not Found or Pages Archive templates?
- Is there any kind of theme on WordPress to sell my own movies?
- Child Pages Short Code plug-in and hover capabilities?
- Classified ad website : which solutions to use? [closed]
- What are the specifics of WordPress development I need to know? [closed]
- What would I need to write into a custom plugin in order to add a switch for a custom string of CSS to the edit page?
- Homemade plugin while using Themify Ultra
- How to create a code editor for my plugin .?
- Finding the URL to be used to check if plugin is installed with a theme
- wp_footer hook only working on homepage not in other pages
- How can I position ShareThis buttons manually when using the plug-in? [closed]
- Adding CSS to custom post type admin page causes error
- How to use get_template part in the plugin?
- how to force tag page layout to use same as search layout?
- Stop Plugin from Getting Styles from Other Plugin
- Great blogs site resources/tutorial for WordPress Developers? [closed]
- woocommerce: Customize email with item total count
- Child theme modifications not showing up
- How to get current template file used by WordPress?
- How can I make a website with dynamic features with wordpress?
- How to generate a responsive output from plugin?
- How to work email subscribe in WordPress?
- How to create post comparison in wordpress
- How to add image for custom taxonomy
- Javascript as Jquery Function Call?
- Integrating WordPress Content into a jQuery Slider
- Editing a theme
- manage_{taxonomy}_custom_column not working
- how to make wordpress remember my choice
- How to Enfroce Domain Licensing Limits? [closed]
- Meta box not displaying on the plugin page
- add_meta_box showing blank screen in my page
- How to create an Info Box on WordPress [closed]
- How to create a “Most Popular” & “Latest” TAB in WordPress
- What are Seeds? [closed]
- Frontend Enqueued Files in the Backend
- I have issue to retrive post thumbnail with rest api
- Custom Plugin not Displaying in the Website Production environment (Divi)
- Custom page template from plugin does not work with pre-installed themes in WordPress 6.6.1
- How can I keep a WordPress dropdown menu open when navigating to a child page?