We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 6806
    • 32 Posts
    I am trying to figure out how to include some wordpress code into a ModX page - specifically to post the first few posts, with some custom markup. Parsing the XML feed just hasn’t been cutting it for me, I wanted more control.

    I have written a custom PHP file that works on it’s own to return to the browser the proper HTML, but I can’t seem to figure out how to make a snippet that will pass that information into modx on a call.

    Am I going about this the right way even?

    I’ve tried adding the contents of that working php file over to a snippet, and having it return some content, and that simply gives me errors (Fatal error: Call to a member function on a non-object in /home/dbowling/public_html/journal/wp-includes/functions.php on line 281)

    require(’journal/wp-blog-header.php’);
    if ($posts) : foreach ($posts as $post) : start_wp();
    $content .= "<h1><a href=’".the_permalink()."’>".the_title()."</a></h1>";
    endforeach; endif;
    return $content;

    Any help would be appreciated.