Skip to content

Instantly share code, notes, and snippets.

@herrbischoff
Last active August 29, 2015 14:18
Show Gist options
  • Save herrbischoff/dcb988f152947fbb7685 to your computer and use it in GitHub Desktop.
Save herrbischoff/dcb988f152947fbb7685 to your computer and use it in GitHub Desktop.
Simple WordPress XML API
<?php
$id = intval($_GET['id']);
require_once "../../../wp-load.php";
$args = array( 'numberposts' => 5 );
$lastposts = get_posts( $args );
foreach($lastposts as $post) : setup_postdata($post);
$vimeo = get_post_meta($post->ID, 'vimeo_url', true);
$xml = "
<data>
<settings>
<vimeo>{$vimeo}</vimeo>
</settings>
</data>";
echo $xml;
endforeach;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment