Nevermind, the last option was actually working, but in my own CSS code I found that I was overriding it. I cleaned up my CSS and it’s working with the function I posted above. I also found an alternative method using wp_add_inline_style()
which got me to look at my CSS code in more depth. Example code below:
function wpdocs_styles_method() {
wp_enqueue_style(
'custom-um-style',
plugin_dir_path(__FILE__) . 'includes/plugins/ultimate-member/ultimate-member.css'
);
$color = get_option('eri_um_account_menu_bg'); //E.g. #FF0000
$custom_css = "
.um-account-side li {
background: {$color} !important;
}";
wp_add_inline_style( 'custom-um-style', $custom_css );
}
add_action( 'wp_enqueue_scripts', 'wpdocs_styles_method' );
Related Posts:
- Redirect to another page using contact form 7? [closed]
- wordpress admin plugin menu custom css
- register dependency css and js inside a plugin class
- WordPress Admin Bar pushed Sticky Footer off the bottom of the page
- Custom plugin: Trying to show saved data on frontend
- Gutenberg Blocks doesn’t render correctly when using do_blocks
- WordPress customizer: load controls in a custom div
- Create custom blocks for bootstrap
- Minify HTML, CSS, JS with PHPWee?
- Archive dropdown styling not applied
- How to display a value from a radio button in the options menu in wordpress
- admin-ajax.php responding with 0
- Page Reloads Before AJAX Request Finishes
- Show post in slider
- How to test nonce with AJAX – Plugin development
- Slider loading issue
- Adding Default Settings to Theme My Login plugin
- Plugin CSS not enqueing
- How to select the contents in the text view textrea in wp_editor?
- Ajax – Call to undefined function get_option()
- Whitelisting items from custom options page
- How to send Ajax request from my plugin in admin dashboard?
- Incorrect MIME type for assets with Valet
- Options API get_option() and update_option() Not Correctly Updating or Returning
- How does wp_enqueue_scripts work?
- AJAX success response is not working but it’s saving my changes
- how to update and display an option without reloading the page
- Saving plugin settings – ERROR: options page not found
- Add Codepen animation as Preloader to WordPress
- Is it save to use eval for a jQuery callback method coming from the database?
- trouble with page_id & highlighting current page
- How to add drag and drop functionalities to a div inside option panel
- Passing the name of selected color from the custom component to `render_callback`
- Post repeated when opening in overlay, how do I solve this? [closed]
- Link to page with posts of specific type
- How to sort posts by active category in WordPress?
- WordPress – Get Posts with Category data
- Add a custom WooCommerce settings tab with sections
- How to use wp_send_json() and output the value with ajax?
- How to Remove Theme Style CSS inside Custom Plugin?
- Settings API form – submit with AJAX
- How to extend SelectControl with data from my theme
- Post form – AJAX won’t upload featured image – Plugin development
- Add other class content with reference class value
- Creating a POP Alert
- How do I integrate vanilla Javascript to a wordpress website?
- Drop down question
- How do I disable cache for a certain page?
- Google CSE Malfunctions via Chrome/Safari on Mobile When Clicking on Either Search Icon/Menu Icon. How to Make Google CSE Default Theme Search
- I have a lot of JavaScript erorrs after SSL someone can help me?
- WordPress Slider is not working
- Bring Font Awesome icons inside menu A tags
- custom field – changing an element or background of id div – different versions not working
- Target a specific container to style on WordPress storefront theme
- Where to find the html for WordPress site? [closed]
- widget: input the px value from user and use it as inline style in widget function
- How to use Amazon Elastic Transcoder from WordPress using AWS SDK for PHP?
- Why this plugin is not working?
- Trying to customize wordpress drop down categories
- how can I make content from a plugin hidden when user is logged in? [duplicate]
- Integrating CSS Into a WP Function Call [closed]
- How to create and add js and css file when server is not on my PC?
- Import js variables loaded via wp_localize_script() into js module without global scope connection
- how to escape alert/window.location.replace with variable
- JQuery UI Autocomplete showing as bullets
- 404 error on page reload
- Validate a custom form with js and php
- Embed dynamic media query in a Gutenberg block
- Add Imports to Existing WordPress Import Map
- Second select list values are not saved after clicking update
- Use wc_enqueue_js only on specific pages – nested add_action
- How to create a custom config file and get data using inline JS in a wordpress page
- Where exactly do I write define( ‘WP_DEBUG’, true ) in wp-config file
- Multiple pages on one with different HTML
- Integrating PHP into Javascript to display map markers with Google API
- How to use a frontend URL with a Plugin
- How to use the php if statement [closed]
- lazy load comments wordpress on click
- Utilize WP-CLI from inside WordPress, not SSH
- functions.php not adding css to website?
- Saving metabox repeatable fields
- OOP Plugin Development. Including external object
- Authenticating to WordPress, using my own authentication two-factor system
- Ajax call doesn’t work in frontend but it’s working in backend (when I’m logged in)
- Data fetch and delete by ajax request
- Use composer to load custom classes [closed]
- How to store accumulate multiple option values in a single array using Options_API
- Handling an Ajax form submit
- Resize Image without cropping
- Customizer Show/Hide Logo and Site Title
- wp enqueue style and style sheet depth
- How to block specific keywords from searching on WordPress?
- Understanding WordPress child theme custom JS loading
- How to create filterable portfolio in WordPress?
- Why is PHP Cookie via plugin only set when logged in as Admin and not regular users? and other questions
- how to create and show sessions in word press?
- WordPress Customizer not setting default value upon initial install?
- Theme Customizer – Dynamic CSS PHP File
- API JSON Data in WordPress
- CSS saved & enqueued, but wordpress doesn’t load css text, only file