SHOW:
|
|
- or go back to the newest paste.
1 | <form> | |
2 | <select name="font_id"> | |
3 | ||
4 | <?php | |
5 | ||
6 | $url = 'https://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyD6j7CsUTblh29PAXN3NqxBjnN-5nuuFGU'; | |
7 | ||
8 | $response = wp_remote_get( 'http://www.googleapis.com/webfonts/v1/webfonts?key=AIzaSyD6j7CsUTblh29PAXN3NqxBjnN-5nuuFGU', array( 'sslverify' => true ) ); | |
9 | ||
10 | $response = wp_remote_retrieve_body( wp_remote_get($url, array('sslverify' => false ))); | |
11 | ||
12 | if( is_wp_error( $response ) ) { | |
13 | echo 'Something went wrong!'; | |
14 | } else { | |
15 | ||
16 | $json_a = json_decode($response, true); | |
17 | ||
18 | $items = $json_a['items']; | |
19 | $i = 0; | |
20 | foreach ($items as $item) { | |
21 | $i++; | |
22 | $str = $item['family']; | |
23 | ?> | |
24 | ||
25 | <option value="<?php echo $str; ?>"><?php echo $str; ?></option>; | |
26 | <?php } } ?> | |
27 | ||
28 | </select> | |
29 | </form> |