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]
- Tips for using WordPress as a CMS? [closed]
- Best way to overide plugin CSS?
- What Are Security Best Practices for WordPress Plugins and Themes? [closed]
- How do I cleanly override a plugin’s CSS with a child theme?
- How can I reduce the amount of files loaded/included per plugin?
- Disable author pages for specific users
- Migrating a File from Plugin to Theme and changing its path → instead create a REST endpoint
- How to add inline css/js inside a shortcode
- Shortcode in AJAX popup
- Can I use a Shortcode output as an HTML attribute value?
- Translating plugin inside the theme [closed]
- How do I write into a file (css)
- How to prevent users to download videos from lms website?
- Different UI in WordPress
- Allow users of my plugin to define their own shortcode rather than use mine?
- add_shortcode is not working in plugin where others are working
- How to hide CSS by default and show on button press
- Some code in shortcode function being ignored
- What is @Action in WordPress?
- Stop Plugin from Getting Styles from Other Plugin
- How to have sample page for each new register users in a membership website
- how to prevent all css and javascripts files from loading
- Front-end CSS Library for plugin [closed]
- How to get menu location in wp_update_nav_menu hook
- Add Shortcode tag in Widget/Sidebar
- WPTouch – how to remove shortcodes or make shortcodes function
- Which wordpress theme is compatible Optima Express theme (real estate inventory) plugin?
- How to Include File from Plugins into Template?
- Custom shortcode for displaying user based on a role parameter
- How to execute plugin and theme updates from a web hook / endpoint?
- WordPress Plugin Insert Html Code with Shortcode
- How do I add a plugin dependency to my customized theme?
- Flickering sidebar when scrolling page [closed]
- Shortcode not working – quotes seems strange
- Is wp_deregister_script the best way to deal with unneeded plugins in a page?
- Form Plugin for Api Requests which is used via Shortcode
- Echo out element to another page.
- Cannot add edit themes and add plugins after multisite update
- Remove updates text on plugin or themes list page
- How to prevent plugin, theme installation failures on WordPress?
- Strange admin-ajax / CSS / $_SESSION issue
- Remove a div class with condition
- How Can I Increase Breadcrumb Position Count (Starting From 2)?
- Main content of site not showing, but does show when logged in to wp-admin
- SASS not showing in customized preloader plugin
- Hooking into the HTML header container
- Shortcode function not showing up on mobile browser
- Get Current Post ID in WP Loop For GiveWP
- Unable to activate themes on localhost
- why my wordpress dont have toolbar like, plugin, themes and other?
- How to link file or image from wordpress plugin dir to theme by using themes function.php, is it possible?
- Creating themes using the one Plugin (Toolkit)
- Strange get_the_* behavior with php 5.4
- Template from scratch: Sidebars not showing widget
- Site is setup statically – how to make it content managable?
- Embedding BitBucket Code in Posting
- Do shortcodes affect page indexing by search engines?
- How to show in front End images using Visual Composer attach_images?
- Javascript as Jquery Function Call?
- Content expands beyond its column container [closed]
- How to escape html code?
- Elementor with system colors instead of kit colors [closed]
- How to modify submit button on GravityForms
- How to get URL param for pagination in shortcode?
- How to add an active state class to my info box
- Prevent primary navigational menu from expanding during page load (WordPress / Astra Theme)