Forum Replies Created

Viewing 1 replies (of 1 total)
  • Forum: Plugins
    In reply to: setup_postdata problem

    I am attempting to use setup_postdata as well. It looks like it’s not quite rock solid. I took a more hamhanded approach, and it seems to work ok.

    // My new post is stored in $pagepost
    
    $stored_post = clone $GLOBALS['post'];
    $GLOBALS['post'] = $pagepost;
    setup_postdata($pagepost);
    
    // Now I can use all my functions, including the_title(), etc.
    // When I'm done...
    
    $GLOBALS['post'] = clone $stored_post;

    No idea why this works, but it just seems that either setup_postdata doesn’t get all the elements in the right place or the other template functions (e.g., the_title(), etc.) seem to ignore what setup_postdata does.

Viewing 1 replies (of 1 total)