Last active
May 27, 2016 11:19
-
-
Save bolstad/5135205 to your computer and use it in GitHub Desktop.
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 $download=json_decode(wp_remote_retrieve_body(wp_remote_get('http://www.reddit.com/r/Wordpress/comments/1a23de/reddit_comments/.json'))); | |
foreach ($download as $comments){ | |
?><ul><?php | |
foreach ($comments->data->children as $comment){ | |
if($comment->data->body != null){ | |
?><li><a href="http://www.reddit.com/user/<?php echo($comment->data->author)?>" target="_blank"> | |
<?php echo html_entity_decode($comment->data->author); ?></a><br /><?php | |
echo html_entity_decode($comment->data->body); ?></li><br /><br /><ul><?php | |
foreach($comment->data->replies->data->children as $reply){ | |
?><li><a href="http://www.reddit.com/user/<?php echo($reply->data->author)?>" target="_blank"> | |
<?php echo html_entity_decode($reply->data->author); ?></a><br /><?php | |
echo html_entity_decode($reply->data->body_html); ?></li><br /><?php | |
} ?></ul><?php | |
} | |
} ?></ul><?php | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment