Last active
June 10, 2020 13:33
-
-
Save Fobiya/b553e8913fde2311320b314283c0fb75 to your computer and use it in GitHub Desktop.
json-php-wp
This file contains hidden or 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
wp-json/wp/v2/posts?_embed&per_page=24&page=1 | |
wp-json/wp/v2/blog/?_embed&per_page=24&page=1 | |
blog - // category | |
?_embed - // echo list img and list topic | |
http://domennn/wp-json/wp/v2/blog?_embed&categories=16 | |
blog?_embed=true | |
https://bionicteaching.com/vue-and-the-wordpress-rest-api/ | |
https://codepen.io/twwoodward/pen/KNJgep | |
https://www.taniarascia.com/how-to-use-json-data-with-php-or-javascript/ | |
$url = 'data.json'; // path to your JSON file | |
$data = file_get_contents($url); // put the contents of the file into a variable | |
$characters = json_decode($data); // decode the JSON feed | |
echo $characters[0]->name; | |
foreach ($characters as $character) { | |
echo $character->name . '<br>'; | |
} | |
$json=file_get_contents('wp-json/wp/v2/blog/'); | |
// header('Content-Type: application/json'); | |
$json=json_decode($json,true); | |
//print_r($json[0]['title']['rendered']); | |
echo "<br>"; | |
print_r($json[0]['link']); | |
echo "<br>"; | |
http://bionicteaching.com/vue-and-the-wordpress-rest-api/ --- | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment