7 posts
  • Bought between 1 and 9 items
  • Has been a member for 1-2 years
Dvaeer says

Developing my first Wordpress theme I’d like to include an options panel with the ability to choose any Google font. I went through the process of signing up for a Google API key for this, but am unsure whether there is a cost involved for this. Google seem to suggest they charge for use of their service through an API key, but it’s not clear to me. Would there be anyone who can give me an insight into this?

Many thanks

1712 posts Don't Worry, Be Happy
  • Beta Tester
  • Grew a moustache for the Envato Movember competition
  • Elite Author
  • United States
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 3-4 years
  • Referred between 200 and 499 users
  • Most Wanted Bounty Winner
+2 more
FinalDestiny says

Uhm, no, you have quite a big number of requests you can make daily. Also I’d recommend you asking the users to put their own api key instead of using your own for all the users

7 posts
  • Bought between 1 and 9 items
  • Has been a member for 1-2 years
Dvaeer says

Thank you! So basically: don’t worry, be happy :)

What if I want to keep it simple for my users and not bother them with API keys? I guess that theoretically I could exceed the amount of daily requests, but in practise would that happen?

Thanks again

1712 posts Don't Worry, Be Happy
  • Beta Tester
  • Grew a moustache for the Envato Movember competition
  • Elite Author
  • United States
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 3-4 years
  • Referred between 200 and 499 users
  • Most Wanted Bounty Winner
+2 more
FinalDestiny says

If you’ll add a payment method, it may get you money from there. If not, it will probably return an error saying that you exceeded the max. number of requests on that day

7 posts
  • Bought between 1 and 9 items
  • Has been a member for 1-2 years
Dvaeer says

That makes total sense. Thanks very much for your insight, much appreciated.

1465 posts
  • Has been a member for 2-3 years
  • Exclusive Author
  • Sold between 10 000 and 50 000 dollars
  • Bought between 10 and 49 items
  • Referred between 1 and 9 users
  • Croatia
OriginalEXE says

Why don’t you just pull an array of available fonts and store it locally, and then you can update the list with each theme update.

That way you don’t have to worry about external requests or api keys.

3428 posts Ruben Bristian
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Won a Competition
  • Bought between 100 and 499 items
  • Exclusive Author
  • Referred between 500 and 999 users
+5 more
KrownThemes says

^ +1

You should never create an app that uses an API like this and include it in a theme which you distribute to the masses. The application is yours only, you cannot distribute the details to your buyers. (i’m 99% sure that this is a rejection reason)

A static list is the best way to go in this case and you’ll upload it from time to time (i update my lists only once a year – nobody dies if the latest font is not available in your theme).

Here’s a serialized array with the latest fonts (can be used with the Theme Customizer): http://pastebin.com/uVAzxgZP

Here’s how to use the list: http://pastebin.com/cUptxCqF

(the chunks of code are not exact, you need to know what you’re doing:)

7 posts
  • Bought between 1 and 9 items
  • Has been a member for 1-2 years
Dvaeer says

Why don’t you just pull an array of available fonts and store it locally, and then you can update the list with each theme update. That way you don’t have to worry about external requests or api keys.

^ +1 You should never create an app that uses an API like this and include it in a theme which you distribute to the masses. The application is yours only, you cannot distribute the details to your buyers. (i’m 99% sure that this is a rejection reason)

Thank you very much for your thoughts on this. I’d like to consider your option, but I’m committed to using the Redux options framework, which requires a Google API key to add google fonts to their typography module.

Many themes I’ve come across incorporate the Redux options framework with a Google API key, for example the freely available Shoestrap theme.

Ruben, you seem to suggest this is not good practise, but do you feel I should really steer away from this approach?

By the way, thank you very much for your detailed answer with practical example, great stuff!

Thanks again

3428 posts Ruben Bristian
  • Most Wanted Bounty Winner
  • Elite Author
  • Sold between 250 000 and 1 000 000 dollars
  • Has been a member for 6-7 years
  • Repeatedly Helped protect Envato Marketplaces against copyright violations
  • Won a Competition
  • Bought between 100 and 499 items
  • Exclusive Author
  • Referred between 500 and 999 users
+5 more
KrownThemes says

Ruben, you seem to suggest this is not good practise, but do you feel I should really steer away from this approach?

Maybe i don’t understand how this works, but if you implement it in a theme, wouldn’t this theme be then sold to many? And if it’s a best seller wouldn’t 3000 people all use your API? That’s my question – it’s your API, not theirs, and again, i bet that you’re not allowed to use approaches like this in commercial themes on TF. You can ask staff, but it’s a bad practice to give your API keys to thousands of people.

Or maybe i don’t really understand what you’re doing..

483 posts
  • Slovakia
  • Sold between 10 000 and 50 000 dollars
  • Has been a member for 1-2 years
  • Most Wanted Bounty Winner
  • Referred between 10 and 49 users
  • Bought between 10 and 49 items
  • Exclusive Author
LubosVolovar says

Check this link

by
by
by
by
by
by