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
- Mixed Content Page: requested an insecure stylesheet error
- WordPress URL Rewrite not working
- WordPress Infinite Scroll without using any plugin
- How to change “Shipping Calculator “field label on Cart Page – woocommerce? [closed]
- New Plugin Review
- Want to create Child theme, but already edited Parent theme css files and some php files
- WordPress Scheduled Event Request Blocking
- How to use my style.css file outside of wordpress subdomain?
- Can I install/embed WordPress on a ‘single page’?
- WordPress wpform plugin submit and get multiple checked value from checkbox [closed]
- Script to browser problem PHP
- wp query foreach deleting record returning only first or last item
- Is a series of update_option calls safe, performance wise?
- Make Database query only when option is updated
- An audio player that showcase a random song from playlist every 24h [closed]
- How to remove sidebar primary widget on Mobile on category page [closed]
- Get related product based on subcategory selected from category id with ID 142
- wp_nav_menu not working correctly in my underscores theme
- Custom Registration username_exists / email_exists
- WordPress language switcher doesn’t work
- Hook on file upload
- Using Ajax to submit a form, and run a SQL Select query based on user input from the form
- No more get_option(‘date_time’) in WordPress 5.5?
- custom mailchimp form using HTTP API
- How to override theme’s public static function inside of a trait?
- pass datetime using wp_localize_script to frontend from settings page
- add custom metabox to media library custom widget
- not able to access $_POST on backend profile update
- Click to expand menu
- I need help implement a Javascript code into the PHP file
- Admin bar nodes
- How can I correctly POST to a WordPress page?
- WordPress – Image href for home menu nav not working
- if is_home(), change class of menu-item-225 of wp_nav_menu
- Load php function with AJAX on modal window
- JSON Object Value Show Undefine
- How to create different templates for woocommerce single-product.php?