• Resolved Jake

    (@jlmg)


    How to display the comment form using a shortcode while removing the default comment form below?

    function my_wpdiscuz_shortcode() {
        $html = "";
        if (file_exists(ABSPATH . "wp-content/plugins/wpdiscuz/themes/default/comment-form.php")) {
            ob_start();
            include_once ABSPATH . "wp-content/plugins/wpdiscuz/themes/default/comment-form.php";
            $html = ob_get_clean();
        }
        return $html;
    }
    add_shortcode("wpdiscuz_comments", "my_wpdiscuz_shortcode");

    my goal is to remove the comments below and use the shortcode for the comments. Thank you guys.

    • This topic was modified 5 years ago by Jake.

    The page I need help with: [log in to see the link]

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Support gVectors Support

    (@gvectorssupport)

    Jake,

    Please make sure the comment form is enabled for the current post type. More info here: https://wpdiscuz.com/docs/wpdiscuz-7/getting-started/manage-comment-forms/comment-form-settings/#post-types

    Thread Starter Jake

    (@jlmg)

    Good day, @gvectorssupport. I’ve enable the comment form but what I want to do is disable or hide the comment form below (default) and keep the comment form in the side. Thank you.

    Plugin Support gVectors Support

    (@gvectorssupport)

    We see wpDiscuz comment form is loaded twice. Please describe in details the changes you’ve done.

    Thread Starter Jake

    (@jlmg)

    @gvectorssupport Good day, Yes the problem is the comment form is being loaded twice. What im planning to do is only load the comment form in the side and hide or remove the comment form below.

    this is what I did in the functions.php

    `function my_wpdiscuz_shortcode() {
    $html = “”;
    if (file_exists(ABSPATH . “wp-content/plugins/wpdiscuz/themes/default/comment-form.php”)) {
    ob_start();
    include_once ABSPATH . “wp-content/plugins/wpdiscuz/themes/default/comment-form.php”;
    $html = ob_get_clean();
    }
    return $html;
    }
    add_shortcode(“wpdiscuz_comments”, “my_wpdiscuz_shortcode”);

    Plugin Support gVectors Support

    (@gvectorssupport)

    Jake

    As a quick solution, I may suggest you use the CSS code below:

    #comments {
        display: none;
    }
    .wp-block-column #comments {
        display: block !important;
    }

    Put the code in the Top Admin Bar > Customize > Additional CSS > “Additional CSS” textarea, save it, delete all caches and check again. 

    Please don’t forget to press Ctrl+F5 (twice) on the frontend before checking.

    Thread Starter Jake

    (@jlmg)

    @gvectorssupport Thank you so much. The comment form below is now hidden. 🙂 Thank you.

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

The topic ‘Remove default comment and display the shortcode in wpdiscuz’ is closed to new replies.