Vote count:
0
I created wordpress shortcode to get user ID by search,
I using foreach() but result not working!
I want foreach because i will make shortocde to get latest instagram images,
Resource:
http://instagram.com/developer/endpoints/users/
http://codex.wordpress.org/Function_Reference/wp_remote_get
http://codex.wordpress.org/Function_Reference/wp_remote_retrieve_body
This is my code:
function insta_id($atts, $content = null){
$my_access_token = "MY ACCESS TOKEN IS HERE";
$get_id = wp_remote_get("https://api.instagram.com/v1/users/search?q=youtube&access_token=$my_access_token&count=2");
$retrieve_id = wp_remote_retrieve_body( $get_id );
$result = json_decode($retrieve_id, true);
foreach ( $result as $user_id ) { // loop start
print_r($user_id); // this working but display all array
echo $user_id->id; // not working!
}
}
add_shortcode("insta_id", "insta_id");
asked 2 mins ago
get instagram user id using php foreach in wordpress
Aucun commentaire:
Enregistrer un commentaire