This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
header('Content-Type: application/json; charset=utf-8'); | |
$api_key = 'PUT YOUR API HERE'; | |
if(!empty($_GET['province'])){ | |
$province = $_GET['province']; | |
}else{ | |
$province = 'Quang Tri'; | |
} | |
$url = 'http://api.openweathermap.org/data/2.5/forecast?q=' . $province . ',vietnam&appid=' . $api_key . '&units=metric&lang=vi'; | |
$content = file_get_contents($url); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add meta fields support in rest API for post type `Post` | |
* | |
* This function will allow custom parameters within API request URL. Add post meta support for post type `Post`. | |
* | |
* > How to use? | |
* http://mysite.com/wp-json/wp/v2/posts?meta_key=<my_meta_key>&meta_value=<my_meta_value> | |
* | |
* > E.g. Get posts which post meta `already-visited` value is `true`. |