316 posts
  • Has referred 10+ members
  • Has sold $10,000+ on Envato Market
  • Has collected 10+ items on Envato Market
  • Has been part of the Envato Community for over 3 years
+2 more
SyamilMJ says

Try sticking to the api whenever possible

//get webfonts json
//http://codex.wordpress.org/Function_API/wp_remote_post
$fonts = wp_remote_post('https://www.googleapis.com/webfonts/v1/webfonts');

//cache to theme for faster access
//http://codex.wordpress.org/Filesystem_API
$url = wp_nonce_url('foo','bar');
$creds = request_filesystem_credentials($url, '', false, false, null);
if(!WP_Filesystem($creds)) {
    return true;
} else {
    global $wp_filesystem;
    if ( ! $wp_filesystem->put_contents( get_template_directory() . '/cache/fonts.json', $fonts, FS_CHMOD_FILE) ) {
        return true;
    }
}

Helpful Information

  • Please read our community guidelines. Self promotion and discussion of piracy is not allowed.
  • Open a support ticket if you would like specific help with your account, deposits or purchases.
  • Item Support by authors is optional and may vary. Please see the Support tab on each item page.

Most of all, enjoy your time here. Thank you for being a valued Envato community member.

Post Reply

Format your entry with some basic HTML. Read the Full Details, or here is a refresher:

<strong></strong> to make things bold
<em></em> to emphasize
<ul><li> or <ol><li> to make lists
<h3> or <h4> to make headings
<pre></pre> for code blocks
<code></code> for a few words of code
<a></a> for links
<img> to paste in an image (it'll need to be hosted somewhere else though)
<blockquote></blockquote> to quote somebody

:grin: :shocked: :cry: Complete List of Smiley Codes

by
by
by
by
by
by