• Resolved chaseman

    (@chaseman)


    I’m including a related posts script below the content on a single page, and the problem I’m having is that as soon as the related posts script is included the user comments suddenly disappear.

    If I for example would put comments_template() BEFORE the related posts script then the comments would appear BUT the related posts list would disappear, something in both codes must cause a clash and I can not figure out what it is that is causing the clash.

    Here’s the code for the related posts script:

    http://pastebin.com/jYTmiCGK

    Any ideas why the problem occurs?

    In the single.php I’ve included it like this:

    include (TEMPLATEPATH . '/related.php');
    
    and then further down
    
    comments_template();
Viewing 3 replies - 1 through 3 (of 3 total)
  • the script does not seem to take care to restore the original query or the $post object that might be distorted through the queries in the script.

    try to add at the beginning (in line 3):
    $temp = $post;

    and at the end (after line 75):
    wp_reset_query(); $post = $temp;

    (not tested)

    Thread Starter chaseman

    (@chaseman)

    Wow thank you a lot that worked, you’re a crack! =D

    @alchymyth, thanks a lot, i was all morning looking for this =)

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Related Posts Script is Canceling Out Comments!’ is closed to new replies.