The effects of alcohol on sustanon 250 leucine for – real weight loss & bodybuilding benefits?
Learnpress problem ...
 
Share:
Notifications
Clear all

Question [Solved] Learnpress problem comment showing

4 Posts
2 Users
0 Reactions
734 Views
Posts: 2
Topic starter
(@jordan)
New Member
Joined: 10 months ago

Hello wpDiscuz Support Team,

I am using your wpDiscuz plugin on a WordPress site with the LearnPress plugin and the SocialV theme. I've encountered an issue related to displaying unique comment sections for each LearnPress lesson.

To integrate wpDiscuz into my child theme, I have added custom code to my functions.php file. This code was necessary to ensure the correct display of wpDiscuz CSS, as it was not loading properly initially. Here is the relevant part of the code:

function my_wpdiscuz_shortcode($atts) {
    // Extracting the 'id' attribute
    $attributes = shortcode_atts(array(
        'id' => '', // Default value is an empty string
    ), $atts);

    $unique_id = $attributes['id'];

    // Adding the unique ID to the HTML structure if needed
    $html = "";
    if (file_exists(ABSPATH . "wp-content/plugins/wpdiscuz/themes/default/comment-form.php")) {
        ob_start();
        // Use $unique_id here if needed to customize the comment form
        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");

// Enqueue wpDiscuz Styles
function my_theme_enqueue_wpdiscuz_styles() {
    // Checking if you are on a page where you want to load wpDiscuz styles
    if (is_singular('lp_course')) {
        // Queue the main style file
        wp_enqueue_style('wpdiscuz-main-style', get_site_url() . '/wp-content/plugins/wpdiscuz/themes/default/style.css');
        // Additional style lines can be uncommented as needed
    }
}
add_action('wp_enqueue_scripts', 'my_theme_enqueue_wpdiscuz_styles');

The issue I'm facing is that the same set of comments is displayed across different lesson pages. I intend to have a unique set of comments for each individual lesson. I suspect this might be related to the custom shortcode implementation or a conflict with LearnPress.

Could you please provide guidance or suggestions on how to achieve unique comment sections for each LearnPress lesson using wpDiscuz? Any assistance or insight you can offer would be greatly appreciated.

Thank you for your support.

Topic Tags
3 Replies
Asti
Posts: 7615
 Asti
Support
(@asti)
Illustrious Member
Joined: 7 years ago

Hi,

Try to use this code:

add_filter('wpdiscuz_js_options', function($jsOption){
    if(!class_exists('LP_Global')){
        return $jsOption;
    }

    $item = LP_Global::course_item();

    if (!$item) {
        return $jsOption;
    }

    $jsOption['wc_post_id'] = $item->get_id();

    return $jsOption;
});
2 Replies
(@jordan)
Joined: 10 months ago

New Member
Posts: 2

@asti 

Hello, 

Thanks for your reply. 

I added the code and it's still the same comments on each lesson : 

Asti
 Asti
Support
(@asti)
Joined: 7 years ago

Illustrious Member
Posts: 7615

@jordan,

The code works fine on our test websites.

Currently, we have plugin customization and PRO support services at the gVectors Team. They can assess the work and fix the issue for you. Just contact us via sales[at]gvectors.com email address.

Share: