You can make sure that your CSS is enqueued after your theme’s CSS and also make sure that your CSS is using rules that are more specific. This will help in making your CSS override the theme’s CSS.
Worse-case scenario you could add !important to a few CSS rules if you are having a hard time overriding your theme.
When you use wp_enqueue_style
you should use the wp_enqueue_scripts
hook, it offers a priority parameter. Here is an example.
function wpse_my_plugin_styles() {
$plugin_url = plugin_dir_url( __FILE__ );
wp_enqueue_style( 'my_styles', $plugin_url . "/css/style.css");
}
add_action('wp_enqueue_scripts', 'wpse_my_plugin_styles', 999);
You could also create a child theme. This would allow you to customize the CSS however you want and not worry about it getting wiped out if the plugin updates.
Related Posts:
- how to include other plugins css files in a shortcode?
- All shortcodes not working on custom theme
- Make the css of the widget overwrite theme css
- Layout shop page: resize images and columns
- How extend shortcode default values for a plugin?
- ‘Customize’ button in admin bar for CSS
- How to generate CSS from a shortcode within a plugin
- Custom CSS for plugin form
- plugin style conflicts, how to override? [closed]
- How to disable CSS rule in Twentythirteen style.css?
- Plugin Handle URL With Custom Theme
- Globally register styles but enqueue them selectively
- Can someone please tell me what is wrong with my plugin?
- Child Pages Short Code plug-in and hover capabilities?
- Redirect to another page using contact form 7? [closed]
- Where are theme codes located for WordPress?
- using do_shortcode
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- How to activate a plugin on the activation of a theme?
- Making that Admin Bar transparent or a blue color
- How to make a dynamic css class whose name changes every visit to confuse scraper
- Blocking Plugin Css to load custom in template directory
- Load CSS files in header of Bones theme?
- How do I work with the SlideDeck plug-in?
- uncaught TypeError: Cannot read properties of null (reading ‘classList’) custom plugin
- Custom Plugin scripts from admin working in frontend
- how to display a template.php in a shortcode
- Image path in childs theme
- WP Plugin CSS not being applied to page
- how to add custom css at top above all css file for specific url
- Speed issues because of CSS & JavaScript
- Child Theme Changes Are Not Reflecting In Parent Theme
- do_shortcodes() isn’t working
- WP Customer Reviews call short code on another page [closed]
- Custom Plugin not Displaying in the Website Production environment (Divi)
- How to remove html code in excel downloads using phpspreadsheet with wordpress plugins shortcode
- Plugin echos text from shortcode function in gutenberg page editor
- How to get current post user id
- Shortcode based chart plugin
- Only Homepage not loading properly
- Uncode theme content block header ignoring saved changes/not updating?
- Two (or more) looks, with one set of content
- Using custom JS plugins with WordPress?
- Different UI in WordPress
- Theme and plugin install or update display error in localhost
- Plugin shortcodes not working in custom theme
- Re-naming a theme/child theme whilst maintaining updates
- Can I make a super plugin that also has a theme?
- Reduce Drop down Menu Width in WordPress
- tag breaks shortcode output (other solutions don’t work)
- Unable to upload wordpress plugins
- Is there an earlier hook than login_head or login_enqueue_scripts?
- The problem with WordPress Importer
- Input with spaces in Shortcode attributes overwritten by defaults
- Theme’s default styles are overriding my plugin’s custom CSS
- Prevent WordPress installing plugins and themes via Admin
- Remove ALL css for a specific plugin page
- How can I create a custom shortcode that will return a custom post type by ID?
- Allow users of my plugin to define their own shortcode rather than use mine?
- CSS from textarea in options page to frontend what to do
- custom changes removed after plugin update
- How to read individual user’s directory and display content to that specific user?
- Adding Shortcode to Text Widget
- W3 Total cache “empty all caches” and no stylesheets render [closed]
- How to put JQuery/Ajax inside shortcode?
- Guidelines / restrictions about advertising /donate begging unside wordpress plugins or themes
- wordpress prevent multiple shortcodes
- Admin Panel pagination link styles
- How to style the RSS wordpress?
- Snippets: is it better to add them in functions.php or make site-specific plugins?
- How Do I Figure Out What File(s) to Edit from Looking at the Source Code [closed]
- Admin Theme customization
- Hooking in to replace the Sidebar/Widget areas
- WSOD after upgrading to 3.1
- Trouble with editing template for “List category posts” plugin
- WordPress Shortcode to get URL Parameters $_GET[‘name’] redirects for no reason at all
- WordPress function not being called from jQuery method
- WPBakery JS composer unused css [closed]
- How to tie dark mode with prefers-color-scheme webkit? [closed]
- AddToAny shortcode in the loop
- Check for security updates
- How to add an automatic refresh in WordPress for a Page/Post or an embedded OneDrive/Excel HTML Code?
- Trouble with plugin styles in admin area of WordPress
- Add a CSS class based on categroy id to archive pages
- Changing “elapsed time” to “time remaining” on MP3-jPlayer audio player with CSS or PHP changes
- How to fix wrong attribute error for Visual Composer Grid Builder?
- Making a Template for a CPT created by a plugin
- (FES EDD) New vendor submission page is blank
- There is any way to remove post-format filter? [closed]
- Plugin-generated pages use Not Found or Pages Archive templates?
- creating html reusable blocks via shortcodes
- Is there any kind of theme on WordPress to sell my own movies?
- Create custom registration form for WordPress Multisite
- Removing included CSS file that doesn’t exist
- add_shortcode is not working in plugin where others are working
- Classified ad website : which solutions to use? [closed]
- Single API call exposed via shortcode with params
- How to hide CSS by default and show on button press
- (Sticky Row) How do i make a row sticky in wpbakery page builder?
- SEO Friendly URL on dynamic product page produced via shortcode