Is it possible? Yes.
Option 1
Simply register and enqueue your default stylesheet. The theme stylesheet can then be used to override whatever styles you implemented.
function register_my_styles() {
wp_register_style( 'default-style', plugins_url('default.css', __FILE__) );
wp_enqueue_style( 'default-style' );
}
add_action( 'wp_enqueue_scripts', 'register_my_styles' );
Option 2
Register whatever custom options you need either on a specific plugin options page or using the WordPress Settings API. Then output these styles in a regular old script block in the theme header.
function output_custom_scripts() {
?><style type="text/css">
<?php echo get_option( 'custom_css' ); ?>
</style><?php
}
add_action( 'wp_head', 'output_custom_scripts' );
Related Posts:
- Are there any official or unofficial guidelines for the styling of a widget?
- How To Protect Plugin Display From Being Affected By Theme’s CSS
- How to give a NavWalker its own stylesheet?
- How do I add CSS options to my plugin without using inline styles?
- Is it ever okay to include inline CSS in plugins?
- How to add sub-menu to a menu generated by wp_nav_menu by using plugin
- Hook in wp.media to add a new tab
- Overide get_template_part( ‘partials/post’, ‘sidebar’ ); with a plugin
- What’s the earliest point I can get the queried object ID?
- Using Primary Color in Plugin Block
- Using a Theme inside a Plugin directory
- Plugin development without Theme adjustments?
- How to prevent loading of all plugin’s resources?
- Programmatically Selecting Theme Based on URL
- How to properly use a hook to create template for custom product type in a plugin such as Woocommerce? [closed]
- Fully automated theme install and activation via a plugin
- What is better way to use Bootstrap inside admin panel?
- wp_enqueue_style built in styles
- Calling plugins API within a theme
- Backslashes being stripped from CSS
- Hook into theme-switching later than `setup_theme`
- Dequeue theme stylesheets but keep widget styling on custom page template
- How to check if a stylesheet is already loaded?
- how to include javascript file and css file in wordpress
- How can I add a CSS rule to edit.php?
- WordPress security issue to output data from user input from theme option form
- Remove Internal Style Sheet if no Value Provided?
- Which themes do you use to test compatibilities with your plugin [closed]
- How do I include background images in my stylesheets in a plugin?
- What parameter should I pass to wp_enqueue_style to depend on the themes stylesheet?
- Is there no admin ui guide for 4.x?
- Correct check for any admin page with editor
- How to Debug: My Plugin Interferes With My Theme
- Theme Install using a Custom Repository
- How to remove default style of header in wordpress metabox
- Auto-Populate Image After Media Upload
- CSS not affecting widget output
- How to create a backend for a custom theme?
- How can I avoid conflicts between plugin and theme?
- How to make “upgrade safe” theme for a plugin?
- Plugin Development/ Stop CSS clashes.
- Can’t change the style of a submit input type? [closed]
- Make a plugin page out of influence of the theme’s style
- Distributing Frontend Assets with Plugins
- My stylesheets are not enqueuing
- Custom Plugin – CSS works, JS doesn’t
- Proper way to include stylesheet for panels
- Apply styles to blockquote element with the WYSIWYG editor
- Styles don’t load correctly. Insecure content
- Completely isolate a plugin view so it doesn’t load the theme
- Does WordPress default CSS have Grids?
- Get images / media attached to a page by page ID
- Create fixed static pages
- How to insert HTML/CSS/JS into my iframe plugin?
- Load stylesheet in edit category page?
- CSS not being applied using wp_enqueue_style
- WordPress Plugin Authoring question about jquery and css
- How to add some basic inline CSS using existing plugin or theme?
- Displaying custom content from a plugin within the active theme
- Why my theme’s css not working on another site
- WordPress plugin development theme issue
- Getting Post ID at “stylesheet” and “template” hooks
- Why does theme’s reset CSS have higher precedence of plugin’s CSS?
- WordPress admin panel not working
- Override category archive page title (not the head title)
- Twenty-seventy theme remove additional CSS from head
- How to hide/remvoe unnecessary field/section in post edit section ( Dashboard )
- Redirect theme directory to plugin theme directory
- Adding and handling custom settings tab to fusion element
- How to customize the size of Featured Images or Post Thumbnails in WordPress?
- how to add custom css at top above all css file for specific url
- Post Pagination does not working on WP-Query
- Publish, Save Draft and Preview buttons do not work after being moved with jQuery
- Unable to link CSS file
- How can I add the Post ID to Class Name in Jquery?
- Managing Custom Designed Content
- Let user override plugin CSS
- Create and style menu
- Best practice to include custom user styles in widgets
- WordPress with PageLines theme: how to change the background color of a page? [duplicate]
- Developing Themes on WordPress, Looking for Excellent Tutorials [closed]
- Find Any Theme’s page.php File
- How to create A – Z List with pictures?
- how to add contact form 7 shortcode in javascript variable
- Problem with inline style CSS properties issue on DIV
- Theme / Divi change visitor css and site logo and all site urls based on REQUEST_URI non logged in wp user
- Is there a way to tell if a shorcode’s handler is being run before or after the content formatting filter?
- Add Admin menus or submenus depending on conditions
- Filter the_content() to add custom figure tags
- Plugin files not updated (cache cleared)
- WordPress User Management Departmental Managers
- Glyphicons Dont Show in WordPress Plugin Only
- How to limit the number of posts a user can view based on status
- Template file structure , wordpress hook for altering the template
- woocommerce single product page hook not working
- Implementing plugin with HTML/CSS form?
- WordPress permalink setting
- $wpdb how can i save my postmeta table before querying it
- Create dedicated page with custom template showing custom data
- Featured images are cropped on index and post page