You should not be outputting anything on the wp_enqueue_scripts
hook, just enqueueing. Move your css output to a function hooked to wp_head
with a lower priority than 8, which is when the enqueued styles are printed in wp_head
:
function folio_enqueue_css() {
wp_enqueue_style( 'theme', get_template_directory_uri() . '/assets/css/style.css', false, '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'folio_enqueue_css', 1 );
function folio_dynamic_css() {
ob_start();
echo '<style type="text/css">';
# css styles here
echo '</style>';
# compress CSS
$output = ob_get_clean();
echo preg_replace('/^\s+|\n|\r|\s+$/m', '', $output) ."\n";
}
add_action( 'wp_head', 'folio_dynamic_css', 20 );
Related Posts:
- Could the WP script/style loader be used to concatenate and gzip scripts and styles in the front-end?
- wp_enqueue_scripts, wp_register_scripts, wp_print_scripts: i’m confused
- Use wp_enqueue_scripts, not wp_print_styles?
- How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?
- wp_enqueue_script + how to load JS or CSS in one URL merge call?
- Relative path instead of absolute for wp_enqueue_script
- Custom Admin CSS styles to style media uploader?
- How to insert html/css/javascript code to wordpress plugin
- How to integrate my HTML and javascript into my child theme
- Child theme stylesheet not always overriding “index”
- wp_enqueue_scripts and CSS
- How can I force Dynamic CSS via ACF values to update on page load?
- functions.php – inject inline css from file
- enqueing Javascript and CSS
- Load custom CSS before admin CSS
- Including CSS files in HEAD based on page content
- Dequeue styles with query doesn’t work
- Bootstrap Integtration
- Enqueue CSS and Script only if needeed
- Change Login CSS – Include instead of echo
- Bootstrap 4 Optimization
- plugin not loading my css and js
- How to insert spaces/tabs in text using HTML/CSS
- How to change btn color in Bootstrap
- Failed to decode downloaded font, OTS parsing error: invalid version tag + rails 4
- How to make the HTML link activated by clicking on the
- ?
- How do I right align div elements?
- CSS text-align not working
- How can I insert vertical blank space into an html document?
- What is the difference between “screen” and “only screen” in media queries?
- How to have an anim gif on a link and play it on hover and reset
- How can I make Bootstrap columns all the same height?
- Align text to the bottom of a div
- How to make a
- display in a horizontal row
- How can I apply styles to multiple classes at once?
- Responsive Canvas in Bootstrap column?
- How do you avoid caching during development?
- Are there Gutenberg container blocks?
- How do i use fontawesome icons in TinyMce editor?
- Why won’t child theme’s style.css override plugin’s css
- some things in child theme css not overriding parent
- Is it possible to create a full width row in WordPress’s editor window? [closed]
- How do I find (index) file in order to change style on CSS?
- Enqueue style for Password Reset page
- How to center a video [closed]
- How to change header & footer to full width? [closed]
- Media library style not loading correctly when selecting a page featured image?
- Use wp_add_inline_style to add code to before wp_head?
- Using uncss or similar with WordPress?
- How can i add note, caution, warning quote inside the text? [closed]
- Add to Cart button woocommerce background and with doesn’t display correctly
- Output terms to post_class()
- Layout using Bootstrap not aligning correctly
- What’s the best way to add the LESS preprocessor to a WordPress theme?
- How to disable the hover effect in WordPress and Elementor?
- What makes WP so SEO friendly?
- what could cause get_stylesheet_directory_uri() to fail?
- Delete a white space using css
- Implementing a simple slider in code?
- CSS – Initial HTML Margin Issue On WordPress Site
- Cannot set property ‘className’ of null at setThemeFromCookie
- Target h1 on single post page [closed]
- Can not find css directory in header
- node.js and webpack throws error when trying to setup node to watch theme folder for saved changes
- My CSS suddenly doesn’t load anymore [closed]
- Is there a way to add new div class via a theme’s Additional CSS interface?
- How can I move my custom css to the very bottom of the head section?
- Wrong image path within inline styles in the head
- Long post titles don’t move to next line
- WordPress Caption Formatting
- The Global Styles missing
- Invert porfolio item order
- WordPress CSS completely broken on IIS
- Advanced method to control cache of enqueued style/script
- How to show address in one row?
- Custom CSS on mobile
- Removing Image Links from Custom Post Type
- Set version number in child’s style.css file
- How to make a sidebar form show at the top of page on mobile?
- I want to transfer my additional css code to my theme file–?
- WordPress changing content:”” to content: "
- How to customize Metaboxes?
- Change image using only CSS [closed]
- Logo Keeps Changing to the Default for Transparent Settings
- Content going full width even though container is not
- Custom Plugin CSS: Can’t update them!
- Align divs in a basic WordPress site
- Altering the design of WooCommerce notifications [closed]
- How can I override an existing custom CSS rule for a specific page
- How can I add this specific link hover effect to a WP site? [closed]
- HTML5/CSS3 Polyfill for wp-login.php
- Bizarre WordPress CSS update problem
- Making a custom CSS per mobile
- Display current category without an active link in wp_list_categories
- WordPress with PageLines theme: how to change the background color of a page? [duplicate]
- Twenty Twelve theme: remove margins
- s2member captcha how to make responsive – css or javascript
- How to define a special character to change the style of my inline code?
- Why is the “Additional CSS” section missing in my theme Customizer?
- Is there a way to edit the fonts of headings without a plugin (in the 2022 theme)?