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
- Conditionally Loading JavaScript/CSS for Shortcodes
- Style custom columns in admin panels (especially to adjust column cell widths)
- How to enqueue the style using wp_enqueue_style()
- How to enqueue style before style.css
- What is the correct way to enqueue multiple CSS files?
- Remove wp_add_inline_style
- Avoid to load default WP styles in login screen
- Hyphens vs. periods in the script slug in wp_register_script?
- Remove inline css added by wp_add_inline_css
- Stylesheet from wp_enqueue_style is overwritten by plugin
- Adding HTML within an image title attribute
- FireFox Inspector :: find CSS file related to
- Why isn’t my theme processing SASS?
- How to combine multiple CSS files and concatenate JavaScripts if WordPress recommends enqueuing them?
- Adding inline styles from a widget
- Custom CSS for full post vs. excerpt (Content Options)
- How to link style.css in functions.php
- Enqueue stylesheets with the same name
- wp_enqueue_style will not let me enforce screen only
- How the Css File is Linked without calling it in header.php?
- how can I change the background color of all posts on my server?
- CSS to remove “comments count” icon from main page [closed]
- How to insert html/css/javascript code to wordpress plugin
- Different ways to load child theme css
- TwentyFifteen: How can it show a different color on every post page?
- Override theme style with other CSS on a specific page
- How to override Bootstrap css with my child theme css in wordpress?
- Is it possible to add a ribbon in the background of h1 on every page?
- Font Awesome 5 Free – far working but fas is not? [closed]
- Making a custom Pagination for multi page blog post
- CSS Minification
- Need help enqueueing webfonts
- Redirect to another page using contact form 7? [closed]
- Which is the correct way to conditionally enqueue a CSS file?
- Custom Background by Page IDs
- Plugin and themes are adding the same stylesheets
- Why the css in twenteenfourteen-child theme take no effect?
- Faster fonts on mobile
- Split Media Queries in different files!
- Display Something in the Header After All Styles are Loaded
- Custom WordPress Theme loads js but not stylesheets
- Google Fonts not loading correctly
- Stylesheet Enqueue Order and Best Practices
- css media query question [closed]
- enqueing Javascript and CSS
- Parent theme styles overriding child theme CSS [closed]
- Different CSS class by category
- Theme JS is available but theme CSS isn’t
- Proper Way to Load stylesheet on Condition
- Including CSS files in HEAD based on page content
- WordPress Child theme fails to override parent theme css
- Missing dns-prefetch link when using “nested” wp_register_style
- Remove header title form page through CSS [closed]
- Is there a way to deque the style with higher priority?
- Centering one product on a single page [closed]
- Custom css per category and per single post belong in each category
- custom css and javascript not working on page defined as template?
- WordPress menu: How to make www.link.com/#name never contain current_page_item class?
- 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 won’t my custom css load with the enqueue method or any other method?
- How do I target this page specifically?
- Edit CSS of a plugin
- Child Theme not loading multiple stylesheets
- WordPress Inline Style missing
- Controling css order
- font style is not working on domain
- Most optimal way of starting fresh, without using other theme or dropping old files?
- Why are my parent styles loading after my child styles?
- WordPress 3.5 + Foundation 5 not working on IE9
- Adding css and js to a blank page created with custom template
- Should I use `get_stylesheet_uri()` or `get_template_directory_uri()` when calling my CSS Stylesheet?
- Stooping a css file from loading in the header
- Making custom pages (with an example to explain the goal)
- enqueue style sheet and bootstrap
- Enqueue MCE Editor CSS in admin page
- Add custom styles to the Raft theme