However, the recommended mechanism for injecting the styles is really not cool. All guides I’ve read online and from WordPress recommend they be added inline to the Head of the document.
That’s how HTML works, no fault of WP’s. Dynamic stylesheets have always been a challenge since CSS is not dynamic language by nature.
There is number of options, which all can be implemented relatively neatly in WordPress, however all have drawbacks.
- Inline styles. Bloat page source size, but just work.
- PHP script serving CSS. Highly flexible, but serving extra PHP script is orders of magnitude slower than serving static CSS file.
- Compiling and serving static CSS files. Somewhat challenging to implement (especially in code for public use), but has least performance drawbacks.
Overall the way to go depends much more on your performance requirements and how will final product be used, than specific option. There is no winning one here.
Related Posts:
- Hook in wp.media to add a new tab
- Customizer Not Saving Options
- Which action is triggered when a theme was modified?
- Customizer: widget-synced triggers twice
- Is there an event or an other method that tells me the preview is loaded?
- My WordPress Plugin code breaks customize.php viewpoint
- How to use a WP_Customize_Control outside of the Customizer?
- Impossible to declare box-shadow with wp.customize?
- How can we upload file to root directory of wordpress
- Don’t print customizer styles when no setting has been used
- Post Pagination does not working on WP-Query
- Dynamic sidebar areas not working on the Theme Customizer
- How will i add an option under customizer the event calendar section?
- function deactivate_plugins does not exist
- what’s the meaning of the field wp_capabilities in table wp_usermeta
- What is wrong with using add_option with Multisite instead of add_blog_option in a plugin
- Trouble with Transient API when W3TC is activated [closed]
- Make Categories and Tags required in admin
- Getting wrong relationship value in $args in wp_Query?
- wp_schedule_event in a class
- custom XMLRPC method plus authentication of user & WooCommerce order
- How to extend LINK TO functionality in ATTACHMENT DISPLAY SETTINGS
- How do I Make a Theme “plugin-ready”?
- WordPress Terminology Options Vs. Settings
- How to modify post content before writing to database?
- Display only certain posts based on visitor’s country?
- Custom user profile, registration, login page with theme
- Plugin Sidebar is not Saving Meta Attribute to Post/Page after “Update”
- Possible to preset a widget’s contents via a plugin script?
- $wp_filesystem returns NULL. What are the dependencies?
- set_sale_price in WooCommerce [closed]
- Synchronize custom post type tags with WordPress default post type tags
- What for the tables ending with the meta used in database of wordpress?
- How to create custom field in worpdress default widgets?
- Ensure function has completed before allowing another Ajax call
- jquery document ready function not being called [closed]
- Loading scripts with wp_register_script and wp_enqueue_script
- WordPress is automatically linking plain text email addresses
- Is Using WordPress Supplied WYSIWYG Advisable?
- How do I add a filter to wp_list_categories() to make links nofollow?
- How to hook into publish post events in wordpress 4.7.5
- What is the best way to embed an JS App in a WordPress Page?
- add_rewrite_rule works in themes function php but when moved into plugin it stops working
- $reverse_top_level works the opposite way according to Codex?
- How to serve different thumbnails/images depending on users browser/platform
- Plugin development – How to use a specific wp_options into the real rendered code in the front end?
- Show disclaimer with accept button before redirecting to the payment gateway website
- Why is the temporary upload always 4.1K
- Problem with dinamic add_rewrite_rule()
- How to export post meta with images in wordpress
- Parse form values before sending to options.php
- My WordPress plugin cannot load my JavaScript file
- Add Minimum Dimensions Text to Featured Image
- how to get context information inside my funcion
- Is disabling test_form in wp_handle_upload a security concern?
- How to connect my wordpress plugin to a remote database securely?
- How to create a backend for a custom theme?
- admin_post equivalent for guest user?
- When echoing my own shortcode, it keeps adding a 1 at the end of my blogpost
- Create Widget or Enable Shortcodes in Sidebar
- WordPress publish_post hook not getting featured image and meta on first publish, but works on updating title
- Add function after the_content
- How to add custom view links to wp-admin/post.php?
- how to create category with code in wordpress using form
- How do I get variables from my plugin’s settings page?
- Get post thumbnail in WP_Query
- How To Protect Plugin Display From Being Affected By Theme’s CSS
- Is it possible to have instead mypage.com/?page_id=81 to have mypage.com/cool/?
- User Data Handling between two plugins
- Woocommerce place order update shipping price
- wp_schedule_event not executing function call, even with add_action
- How to query a nested field in wordpress api using _fields param
- function add custom fields to media gallery
- ajax response strips multidimensional array and unable to decode
- Using AJAX to submit and return data inside the WordPress Plugin Boiler Plate framework
- Add quick edit functionnality to plugin table
- The Events Calendar featured image as body background?
- using wordpress acf shortcods in tables goes outside the table
- Pass javascript result to shortcode executer function
- remove different admin menu for specific users
- add pagination to wp_remote_get
- Not able to Update database while creating a custom module
- How to load css file after a certain css file
- Shortcode from a plugin not working
- Plugins and how to assign urls to content
- Deactivate Other Incompatible Plugin Upon Activation
- How to make auto installer Plugin?
- Can’t get query string in ajax call
- first_name property missing inside register_user action hook
- Pass results of custom query to loop – when writing a plugin
- How do I use (or mimic) document.getElementById() on a page loaded from WordPress database?
- user can login from single account detail from multiple locations(computer) at the same time [closed]
- WP Cron registers hook without any action (does not call the function)
- Help interpreting @wordpress/create-block-tutorial-template usage error
- Leveraging Core Functionality in Icon Upload Plugin [closed]
- Is it within WordPress guidelines to update another plugin’s database fields from my own plugin? [closed]
- Block Development: hamburger module throwing error in save function
- How can I chanage the user for the composer container in wp-env?
- Adding a navigation with wp_nav_menu() to a custom block in the site editor
- Why isn’t custom sidebar panel not showing up in the Gutenberg Editor?