Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Font Awesome on the front-end may conflict with themes #699

Closed
ziodave opened this issue Nov 14, 2017 · 12 comments
Closed

Font Awesome on the front-end may conflict with themes #699

ziodave opened this issue Nov 14, 2017 · 12 comments
Assignees
Milestone

Comments

@ziodave
Copy link
Member

ziodave commented Nov 14, 2017

Please describe the issue here:

We might need to reconsider our font-awesome usage on the front-end to avoid conflicts with themes.

See https://freeyork.org/photography/atlas-of-beauty-photographer-travels-the-world-to-capture-the-beauty-of-500-women-around-the-world/

Please provide additional data about your WordPress install:
[ ] WordPress version: 4.8.3
[ ] WordLift plugin version: 3.15.5

@ziodave
Copy link
Member Author

ziodave commented Nov 14, 2017

We use font-awesome in 3 less/CSS files:

  • wordlift-faceted-entity-search-widget.less, used by the faceted search shortcode.
  • wordlift-ui.less, used by the shortcodes geomap, chord, navigator, and wordlift in general.
  • wordlift-reloaded.less, used in admin.

@ziodave
Copy link
Member Author

ziodave commented Nov 14, 2017

I found out that the conflicting Font Awesome is loaded by another plugin and it's an older Font Awesome version 4.6.3 while we load 4.7.0.

Therefore I am putting this on-hold, since we want to refactor generally speaking the widgets, this will be solved then.

@cinghaman
Copy link

Is there a filter I can add to my functions.php file to block wordlift to load font awesome as it is already loaded through the theme and now it is creating multiple fontawesome calls

@ziodave
Copy link
Member Author

ziodave commented Jul 11, 2018

@cinghaman I'll take a look.

@ziodave ziodave added this to the 3.19.3 milestone Jul 11, 2018
@ziodave
Copy link
Member Author

ziodave commented Jul 11, 2018

font-awesome is currently referenced by the following css:

  • wordlift-reloaded.css:
    • dashboard (wordlift.php).
    • TinyMCE editor (wordlift_editor.php).
  • wordlift-ui.css
    • navigator shortcode (class-wordlift-navigator-shortcode.php).
    • chord shortcode (class-wordlift-chord-shortcode.php).
    • geomap shortcode (class-wordlift-geomap-shortcode.php).
    • frontend (wordlift.php).
  • wordlift.css: never used
  • wordlift-faceted-entity-search-widget:
    • faceted search shortcode (wordlift_shortcode_faceted_search.php).

This is where we use font-awesome:

  • initial setup screen (step-1,2,....php and wordlift-admin-setup.php).
  • edit.js (loaded by class-wordlift-admin-post-edit-page.php).
  • wordlift-carousel.less (.wl-angle.left and .wl-angle.right classes).
  • wordlift-reloaded.less (.wl-more, .wl-less, .wl-annotation-label-icon, ..wl-annotation-label-remove-icon, .wl-deselect-widget, ...)
  • wordlift-navigator-widget.less
  • wordlift-functions.less
  • wordlift-label.less
  • wordlift-faceted-search-widget.less

@cinghaman
Copy link

hmm so there is no easy way I could just add_action > wp_deregister_style fontawesome from your plugin

@ziodave
Copy link
Member Author

ziodave commented Jul 11, 2018

Nope, in the medium term I think we should remove the font-awesome dependency.

In the short term we could however split the font loading to a separate style sheet which could then be filtered.

@cinghaman
Copy link

That would be great

@ziodave
Copy link
Member Author

ziodave commented Jul 11, 2018

I think we should focus on wordlift-ui.css and wordlift-faceted-entity-search-widget.css because these are loaded in the front-end.

@cinghaman
Copy link

Yea, it's the front end issue only as it adds additional resource/request and especially in my case I am loading the font-awesome from my assets folder so they get cached properly.
And this additional request adds few microseconds

@ziodave
Copy link
Member Author

ziodave commented Jul 11, 2018

Yes, I can totally relate to that. Ok, I'll send an update soon.

ziodave added a commit that referenced this issue Jul 11, 2018
…to filter out that css (this is valid only for the front-end)
@ziodave
Copy link
Member Author

ziodave commented Jul 11, 2018

Find here a development version for WordLift 3.19.3. The font-awesome fonts are now loaded in a separate dependency and there's a new filter that you can use to turn that off (only for the front-end), e.g.:

add_filter( 'wl_include_font_awesome', function( $include ) {
 return false;
} );

Travis is running UTs here.

Please remember not to uninstall WordLift before updating otherwise the vocabulary would be deleted.

wordlift-3.19.3-dev.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants