Using the plugin without the Kit
-
I included fontawesome myself on the back & frontend but it doesnt work. I dont want to use the font awesome kit.
This is what I did:
1. Change in the options version to 6.x
2. No token or kit selection.
3. Tried the acf field (its empty) ??Is there a way to fix this? Can’t to use the kit/cdn on this project. No external sources allowed for this project. So no API, KIT or CDN.
As you can see in this image the icon works but the search doesnt:
https://devtof.nl/fontawesome.pngEdit:
Not using any filters. Working like this worked for the 5.x versions.
Just want to include my own FA and use a ACF field so the client can choose an icon.-
This topic was modified 3 years ago by
tatof.
-
This topic was modified 3 years ago by
-
So using a kit is not required to use this plugin. It will fallback to using the free version of FontAwesome if no kit is selected.
The problem you are seeing doesn’t feel related to this though. Just to clarify as it isn’t clear from your screenshot, have you typed something into the search field? In this latest version of my plugin, nothing will appear until you type at least one character to start searching.
Assuming you have and nothing is showing up, is there any reason that your web server would be blocking API requests to FontAwesome? The way this plugin works is that your search string is sent to to the FontAwesome API to return matching icons. You mention that ‘no external sources’ are allowed for your project so I am not sure if that will rule out this plugin for you. It should still be possible on the frontend to serve the FontAwesome assets yourself, but at minimum the API would need to be used on the backend while selecting icons.
Yes I typed “search”. (worst possible word to type for a demo sorry)
Just changed from “light -> regular” in the acf settings. Could be the solution because of the “free” version but doesnt work ??The plugin worked perfectly 1 hour ago with fontawesome 5x on exactly the same acf field. When I changed it to fontawesome 6x the search broke down. 5x also made use of the API search right?
At this moment there is no API blockage. (future there will but thats an problem for an other moment. Could make exeptions..)
Fontawesome 6x was installed with the setup of the project. And worked fine with the plugin on 5x. Only some icons were different after selection them. So I wanted to fix that and selected the 6x version in the plugin settings
Edit:
Turned back to the fontawesome 5x setting in the plugin and the search field works again.
https://devtof.nl/fontawesome55.png (these are 6x icons (woff2 files) with the 5x plugin setting)So it only the 6x that doens’t work without selecting the api key. ??
The FontAwesome API is only used when you are using FontAwesome 6.x. The previous versions 4/5 do not use the API.
You are correct that having the ‘light’ enabled would have caused you some issues as that is a Pro feature and only available within this plugin when you have a pro-enabled kit.
Can you tell me if you are seeing any javascript errors related to FontAwesome/this plugin in your browser’s developer tools? Same question for PHP errors if you are able to check those on your server? Be sure to check *after* having attempted a search from one of the fields.
-
This reply was modified 3 years ago by
Matt Keys.
Noo the chrome console is clear. no errors ??
Php errors I will look at tomorrow. to be continued
Okay let me know what you find there. A couple other thoughts:
1) A search of the term “Search” with only the Regular icon set selected would produce zero results. There are icons in the Solid and Brands icon sets that should produce some matches for that term.
2) I am not sure what you level of comfort is with logging and debugging PHP code. But pretty much all of those API search business happens here:
/advanced-custom-fields-font-awesome/assets/inc/class-ACFFA-Loader-6.php:145 in the ‘get_ajax_query’ function. For instance logging the response of $remote_get in that function would be of interest here.
Why would the term search result in zero results?
https://fontawesome.com/search?q=search&s=solid%2Cregular%2ClightAnyhow “doc” also returns nothing. both terms return 10+ results in the 5x version.
https://fontawesome.com/search?q=doc&s=solid%2Cregular%2ClightWill look into the debug / logging from the server tomorrow
Oke i’m one step closer! ??
Both fontawesome 5 / 6 give different results:
https://devtof.nl/fontawesomeweird.pngFun fact… font awesome finds some stuff with the term “file”.
edit:
I can see the problem! fontawesome 6 changed the namings of icons.Search is named search in v5
https://fontawesome.com/v5/icons/search?s=regularAnd search is named “magnifying glass” in v6
https://fontawesome.com/search?p=1&q=search&s=solid%2CbrandsThis would be the equivalent page on the FontAwesome website to the search for the term ‘Search’ you were doing:
https://fontawesome.com/search?q=search&m=free&s=regular
Note that it is limited to the Free + Regular icon sets in that search, and has no results.
And yes, FontAwesome 5 and FontAwesome 6 in this plugin use different search engines. With FontAwesome 5 it did a basic string match on the class name of the icons. With FontAwesome 6 it uses their search API for ‘fuzzy matching’. This new search is the same one used on FontAwesome.com
It looks like it is all working for you now though?
-
This reply was modified 3 years ago by
Matt Keys.
Conclusion: The search only works on the name of icons when you don’t use the API.
When using the api fontawesome translates the term “search” to magnifying glass. (wich is awesome) But that doesn’t work when you don’t use the api. In fontawesome 5x it works without the api because the magnifying glass is simply named “search” ??
The plugin has no bug.. its only not nice that the search function is limited by the api token.
Thanks for helping though! ?? appreciate it
-
This reply was modified 3 years ago by
tatof.
ow damn. Fontawesome uses a different search for free/pro. weird.
Pro “search for search”
https://fontawesome.com/search?q=search&s=regularFree “search for search”
https://fontawesome.com/search?q=search&m=free&s=regularwhen removing “&m=free” from the url the search query works. Is there a way for you to implement the “pro” search function?
Really don’t understand why they made a different search for this :’)
The pro search has already been implemented in this plugin. However it uses your FontAwesome Token and Kit so I am not sure if it will meet your specific needs or not.
The search is actually a bit more powerful than just saying “Free” or “Pro” icon sets. Kits can be configured to a very specific version of FontAwesome, and custom icons can be uploaded to a Kit. When you tell my plugin to search with a Kit, it knows how to find those custom icons, and search within the version number of the Kit that you configured.
So for your use case you could for instance make a kit with version 6.1.0 of FontAwesome icons, pro icons enabled. This kit would be used to show icons in the backend/admin area and for search API calls in the backend as well.
On the frontend you could still choose to host the pro icons of your chosen FontAwesome version locally.
“” On the frontend you could still choose to host the pro icons of your chosen FontAwesome version locally. “”
This sounds like a perfect solution. Backend using the kit. Frontend my own implementation.
Can you help me with dequeue-ing the frontend implementation of the plugin? Or is there any documentation? ??
This plugin does not enqueue the FontAwesome assets on the front end unless you configure it to do so. The default is to *not* enqueue.
When adding a FontAwesome field to your ACF field group, look for the ‘Enqueue FontAwesome?’ setting. If you configured this long ago perhaps you set it to ‘yes’ and have since forgotten about it.
So the “fontawesome bandwidth limit” is only used on the backend right? And I can “lockdown” the website from outside sources on the frontend.
Perfect! case closed. ??
Thank you for your patience & help!
-
This reply was modified 3 years ago by
tatof.
Yeah I think you are talking about the “Pageviews limit” for the kit, which in this case would only apply to the admin/backend area of your site if you host it locally on the frontend. In practice I’ve never run up against this limit (1,000,000 pageviews a month is a lot!). I suspect it is to prevent someone from sharing their kit with the whole world.
Perfect! case closed. ??
Thank you for your patience & help!
Glad to hear it, your welcome.
-
This reply was modified 3 years ago by
- The topic ‘Using the plugin without the Kit’ is closed to new replies.