Forum Replies Created

  • The output to the actual archive page works perfectly, i can see all the posts; however when i create the new Domdocument and save it (all within the wp loop) it saves the page (name.xml) but it only shows a single post and not all the posts in that post type loop.

  • Thanks Hazard that was closest to the solution.
    I created an archive-custom-pt.php and used $title= get_field('title'); to populate the XML document.

    Sample idea

    $doc = new DOMDocument('1.0','UTF-8');
    $doc->formatOutput = true; 
    $doc->preserveWhiteSpace = false;
    $root = $doc->createElement('Book');
    $root = $doc->appendChild($root);
    // Title
    $title = $doc->createElement('title');
    $title = $root->appendChild($title);

    The only issue i have now is it will write the post custom field data to the books.xml but only a single post and not all the posts.

    Thank you for your help!

Viewing 2 posts - 1 through 2 (of 2 total)