Created
February 14, 2015 19:58
-
-
Save blobaugh/f60fb50838edabd49159 to your computer and use it in GitHub Desktop.
WCMaui Code Demo
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
add_filter( 'the_content', function( $content ) { | |
$response = wp_remote_get( 'http://ben.lobaugh.net/wp-json/posts' ); | |
if( '200' == wp_remote_retrieve_response_code( $response ) ) { | |
$posts = json_decode( wp_remote_retrieve_body( $response ) ); | |
foreach( $posts AS $p ) { | |
echo $p->title->rendered . "<br/>"; | |
} | |
} else { | |
echo "Something bad happened"; | |
} | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment