ERROR: Missing font family: $font. The requested font family is not available.

"; } else { $errormessage = "

ERROR: Something has gone wrong with your font request. Google returned an error.

"; } } else { $font = urldecode($font); //error checking - validate apikey if(!$google_api_key) { $errors = true; echo "

In order to use this option, you are going to need a Google API Key. Click on the settings icon on the top toolbar to get and enter your Google API credentials.

"; } else { $api_url = "https://www.googleapis.com/webfonts/v1/webfonts?key="; $api_data = wp_remote_get($api_url . $google_api_key); $data = json_decode($api_data['body'],true); echo "

(Click on variants to inspect in previewer)

"; $items = $data['items']; foreach ($items as $item) { if($font == $item['family']) { $str = 'Variants:'; foreach ($item['variants'] as $variant) { $str .= ' ' .$variant. ', '; } echo rtrim($str,', ').'

'; $str = ""; $str.= 'Subsets:'; foreach ($item['subsets'] as $subset) { $str .= ' '.$subset. ', '; //$str .= ' ' .$subset. ', '; } echo rtrim($str,', ').'
'; } } } } ?>