Generate an XML using wordpress functions
-
Hi,
I’m trying to load markers on a google map. I have a function called placeMarkersAjax which accepts a parameter xml.
placeMarkersAjax(‘<?php bloginfo(‘template_url’); ?>/markers.xml.php’);
What i did was point this to a php file in my template directory. It works fine if the content of the php is like this.
<?xml version=”1.0″?>
<markers>
<marker>
<name>Name</name>
<lat>11.972913599129404</lat>
<lng>121.91499352455139</lng>
</marker>
</markers>The marker is successfully loaded in the map. However I want to loop through posts and grab a latitude and longitude custom fields. So I need to use wordpress functions. When I add
<?php
require(‘../../../wp-blog-header.php’);
?>on top of the file. It no longer works. When I try to access the file in the browser. The XML content looks the same if the require code is there or not.
I guess how do I use wordpress functions in this case? when i try to add the require line javascript no longer parses the xml. I also tried adding
header(‘Content-Type: text/xml’);
It still doesn’t work.
Please help me.
thanks,
Milo
- The topic ‘Generate an XML using wordpress functions’ is closed to new replies.