It’s easy to add your plugin stylesheet after theme stylesheet. If you’re sure that your theme styles and plugin styles have the same selector weight (theme has this style .site-header { background-color: #ccc; }
and your plugin has this .site-header { background-color: #f1f1f1; }
) then enqueuing plugin stylesheet after theme stylesheet will work.
If you’re enqueuing with wp_enqueue_scripts
action hook then changing the hook priority parameter will do the work. Here’s an example:
function op_enqueue_scripts() {
wp_enqueue_style( 'bootstrap', 'https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css' );
}
add_action( 'wp_enqueue_scripts', 'op_enqueue_scripts', 50 );
If priority 50 doesn’t work then try increasing that to 80 or 100.
Related Posts:
- How to load different css file for different pages
- Making a plugin only available on the front-end for the logged in super admin
- Adding Font Awesome to WP Plugin
- wp_enqueue_style on template_redirect level?
- plugin enqueue style on all pages
- is it possible to hook every page style?
- wordpress plugin add page when activate
- How to add styles to a submenu page?
- WordPress plugin from own server
- How to avoid plugin name conflicts from the upgrade notifier?
- Show Similar Post Titles ( Similar to Stack Exchange )
- How do I unlock a post programmatically?
- Customizing subject in comment notification e-mails
- How can I dequeue a Plugin Stylesheet?
- Add content to /wp-admin/plugin-install.php admin screens
- Need a function for changing saved post_date or post_date_gmt to relative time in wordpress
- Activate Plugin which is in subfolder?
- Plugin child folder?
- Autoload via composer in plugin interference
- merging an array to an existing array using add_filter
- How do I store information in a dynamic block in WordPress?
- How to enqueue a theme style-sheet to my admin settings page?
- Is it possible to set up multistore in Woocommerce? [closed]
- Plugin exceeds memory limit
- Find the URL of the current plugin directory
- Determine Registered Admin Menus
- How can I get WordPress to save comments in markdown format?
- Help With MySQL to WPDB Query Conversion
- code is working properly in Core PHP but writing coding in WordPress
- 306 MB of wp_options occupied by WordPress SEO Plugin, is that normal? [closed]
- Custom plugin init action causing general slowness
- Perform internal redirect in WordPress?
- How to prevent plugins from loading jQuery
- Inject HTML meta tag inside wordpress tag using add_shortcode
- How to get the permanent link in a plugin?
- Duplicate results are displayed in a custom plugin [closed]
- Disable Individual Plugins (specifically in Custom Post Types) on a per-post basis?
- custom uploader in the admin area
- Best/Correct way to add an option to a category
- Basic question about accessing scripts in my plugin
- Automatically download, install and activate plugins that my plugin depends, how?
- How to create WordPress custom end point with multiple parameters?
- How to redirect to same page after form submission
- I receive taxonomy id
- Loop in elementor custom widget not working
- WordPress SVN UTF-8 issue
- Custom plugin – load enqueue only for this plugin
- Asynchronous request in wordpress
- How to access OOP plugin function inside themes or other plugin
- change or add css to theme from plugin
- Displaying data from another database
- Every time I de-activate a custom plugin, the site encounters a critical error
- Custom Fields for Page Edits
- Apply html elements in php statement
- How do I remove all traces of a plugin?
- Is it possible/advisable to set last stable version to previous version?
- How to make sure settings are not lost when plugin is updated?
- How Can i import plugin option?
- How to override any plugin file in the child theme
- How can replace this url
- How to overwrite a plugin?
- How can I translate something in my class constructor of my plugin in WordPress?
- Define global variable in theme file and call that variable in plugin file
- SimpleXML is not working with xml response from external api
- Custom Plugin Update
- How do I stop plugins and themes from getting updated in a new plugin?
- How come W3TC is allowed to host premium code in the WordPress repo?
- Multiple image selection custom widget
- Custom wp_list_tables redirect on specfic page
- Passing function into add_action always returns the first argument
- Hook to display element as product on category page
- Missing files in enqueue actions causes WordPress to reload
- I can’t use WP_Query
- Adding/ Removing actions for plugins
- Creating Nested custom fields
- plugin not hooking to my custom hook
- Populate select option with JSON file
- Enahanced search for edit.php and custom post type
- WP Plugin: Print javascript in header
- Adding list of Indexes in wordpress document
- API Functions to Register and Show WordPress List Tables
- How to save default values into an option and delete those upon actvation and deactivation in wordpress?
- How to Add Jquery FullCalendar in wp plugin in admin
- Ajax, jQuery and WordPress
- Add custom fields in the new and edit the site forms without touching the WP core
- Extend WordPress REST API with Scheme Pro Plugin
- How to submit the custom form data in database in WordPress without plugin?
- Unable to show 4 products in a row
- WordPress check box unchecked on null value ternary operator [plugin development]
- Embed php code in custom field of a plugin [closed]
- Why haven’t I see plugins using get_file_data to handle retrieving plugin version?
- Suitable hook when creating, updating and deleting posts programmatically
- add_meta_box showing blank screen in my page
- How can I gather forums posted by visitors from different sites in one place? [duplicate]
- How to make content as required in custom post type?
- How to create a “Most Popular” & “Latest” TAB in WordPress
- is_user_logged_in() undefined at shutdown in plugin context
- What are Seeds? [closed]
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- Plugin translations are not loaded from translate.wordpress.org