Created
August 13, 2012 19:43
-
-
Save mjangda/3343560 to your computer and use it in GitHub Desktop.
Output a JSON Feed of posts in a zone
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 | |
// This will be accessible at /feed/zones-json/ | |
add_feed( 'zones-json', 'x_render_zones_json_feed' ); | |
function x_render_zones_json_feed() { | |
if ( function_exists( 'z_get_zone_query' ) ) { | |
$query = z_get_zone_query( 'zone-name' ); | |
header('Content-type: application/json'); | |
echo json_encode( $query->posts ); // you'll obviously want to strip down the data that's output | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment