• Resolved rdosza

    (@rdosza)


    For a reason (I open a CPT post in modal from a link of a page of another CPT) I need to set wpDiscuz comments template outside the loop (defining the post_id).

    For standard WordPress comments template it would be something like this:

    
    <?php comment_form( $args, $GLOBALS['post']->ID ); ?>
    <ol class="commentlist">
        <?php    
            //Gather comments for a specific page/post 
            $comments = get_comments(array(
                'post_id' => $GLOBALS['post']->ID,
                'status' => 'approve' //Change this to the type of comments to be displayed
            ));
    
            //Display the list of comments
            wp_list_comments(array(
                'per_page' => 10, //Allow comment pagination
                'reverse_top_level' => false //Show the latest comments at the top of the list
            ), $comments);
    
        ?>
    </ol>
    

    How about for wpDiscuz? Is it possible?

    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Plugin Author gVectors Team

    (@gvectors-team)

    Hi rdosza,
    I’m sorry but this is not possible with wpDiscuz. wpDiscuz uses global $post on post loading process, the original variables of post environment are missing on the modal.

Viewing 1 replies (of 1 total)
  • The topic ‘Comments outside the loop’ is closed to new replies.