We can use style_loader_tag
filter to filter the link that is being output.
Here is the filter:
$tag = apply_filters( 'style_loader_tag', "<link rel="$rel" id='$handle-css' $title href="https://wordpress.stackexchange.com/questions/231597/$href" type="text/css" media="$media" />\n", $handle, $href, $media);
Here the link $handle for which you want to add attribute is font-awesome
so if the handle, so you can replace font-awesome-css
with extra info.
add_filter('style_loader_tag', 'wpse_231597_style_loader_tag');
function wpse_231597_style_loader_tag($tag){
$tag = preg_replace("/id='font-awesome-css"https://wordpress.stackexchange.com/", "id='font-awesome-css' online=\"if(media!='all')media="all"\"", $tag);
return $tag;
}
Related Posts:
- How to add crossorigin and integrity to wp_register_style? (Font Awesome 5)
- Is it ever okay to include inline CSS in plugins?
- How to force stylesheet to load before anything else in header?
- To enqueue or not to enqueue
- Enqueued Stylesheet Version Number Not Being Appended
- I want to include my style.css in function.php file?
- Include user defined styles without including wp-load
- Never Enqueued Stylehsheet
- Changes in enqueued / registered stylesheet paths not updating—why?
- Which is the best way to incorporate custom fonts?
- Additional CSS – crashing with javascript-html minifier?
- How do I view registered syles and scripts for enqueue
- stylesheet in header or functions?
- different style sheet for just one page template
- What is the difference between the different ways of linking stylesheets
- Enqueuing a stylesheet and ensuring it’s loaded before (not after) the theme’s stylesheet
- str_replace inside specific css files [closed]
- How to properly add my styles overriding current styles
- CSS style and app.js not loading
- Can’t Workout Dependency of Stylesheets
- Homepage not loading correctly, but then loads when refreshing
- Custom admin bar css on front end bug
- Custom css per category and per single post belong in each category
- How To Style Links in Content Area With Tag Automatically?
- Assign Custom classes to every Excerpt
- is there a way to get all queued scripts/styles into a template without `get_header()`?
- Can’t change theme name
- Stylesheet overriding in Child theme
- Inline-Table under TwentyTwelve not working
- custom css and javascript not working on page defined as template?
- Deregister a CSS file that comes with a plugin
- CSS not being applied using wp_enqueue_style
- styles/default.css in markup, where does it come from? [closed]
- Use conditionals with wp_enqueue_style to attach stylesheet according to post type displayed
- My blog suddenly can’t find my stylesheet?
- WordPress menu: How to make www.link.com/#name never contain current_page_item class?
- Create Columns with Custom Walker and CSS Classes
- Load CSS before Theme CSS
- Turn off display for custom sidebar post widget when on the post it’s displaying
- How To Load wp_add_inline_styles
- How to add Custom Css within the Editor?
- Why would the child theme load in the Customize preview, but not on the site itself?
- Advanced method to control cache of enqueued style/script
- Will WordPress updates remove Gutenberg Additional Classes?
- Custom CSS Nav Menu Style Not Being Applied
- custom email validation using javascript api with elementor pro and code snippets
- Dequeue styles with query doesn’t work
- Save custom option in CSS file
- style.css is not loaded in other template files than index.php (eg. front-page.php)
- Problem with displaying CSS Stylesheets – Am I adding them correctly in my wordpress child theme?
- Enqueued style gets commented if not logged in
- Style WooCommerce Product Search Widget
- How to enqueue stylesheets in child-theme functions.php?
- why won’t my custom css load with the enqueue method or any other method?
- Dequeing Parent Fontawesome Deques Parent Styles
- Use Theme CSS in custom code
- Changing the CSS with a plugin
- how to change a static testimonials into dynamic
- How to reference different css (bootstrap) stylesheets for the header and body of a page?
- Add inline CSS to login page with wp_add_inline_style
- How can I style the Comment Section of a blog post
- Stylesheet does not load despite functions.php
- Bootstrap Integtration
- Hide entry-header for a specific category
- How do I make elements in mobile only reverse order?
- How to style bootstrap container in WordPress?
- how to add custom html and css to wordpress
- Move dashicons.min.css to Footer
- Set different css stylesheet for specific pages [duplicate]
- How can I delete the word `Category:` from page titles? [duplicate]
- How to have different background image based on post category
- My Child Theme CSS Isn’t Working
- How replace theme styles?
- Font size decreases when child theme is created from parent theme?
- Wrap WordPress Login Form in custom Div
- Customize WP website specific column with CSS
- How do I target this page specifically?
- Edit CSS of a plugin
- How do I change the content of an element for a theme without losing the styling?
- style.css of my custom theme is not being applied at all
- How do I dequeue a Stylesheet, stored in an ‘Assets’ folder?
- I can’t override CSS
- custom field – changing an element or background of id div – different versions not working
- Child Theme not loading multiple stylesheets
- Two color in one Heading
- wordpress doesnt add media.css file
- How can I troubleshoot enqueue in general and loading Google fonts specifically?
- Customiser colour picker and best practice for updating css
- Move text from the side of image to below image [closed]
- WordPress Inline Style missing
- Style Radio Buttons inside Edit Page (Custom Fields)
- Adding separate CSS files for separate pages with functions.php
- How to offload CSS and JS files from wp-content/themes folder?
- Change Background Color For CPT Template
- Stuck with Enqueue Styles for multiple css files in a child theme
- How to echo custom styles in css format?
- Customize the reset password page?
- Background setting isn’t applied to entire sidebar height
- Controling css order
- custom post with loading script per single post