Toolonomy Logo
Last Updated on: June 18, 2021

Oxygen Builder & WPDiscuz Integration [PHP Snippet]

0 Shares

If you want to integrate the wpDiscuz comment system plugin with Oxygen Builder then this PHP code snippet is going to help you make them work with one another just by adding a shortcode to the single post template of Oxygen Builder.

/**     
 * Add this code to the Oxygen Builder single post type content using a code block element.
 * @see https://github.com/soflyy/oxygen-bugs-and-features/issues/2214
*/
<?php comments_template(); ?>

OR

<?php

/**     
 * Display the comment template with the [ wpse_comments_template ] shortcode. Note: Remove the spaces between the shortcode and [] brackets.
 * shortcode on singular pages. 
 *
 * @see https://stackoverflow.com/a/28644134/2078474
 */
 add_shortcode( 'wpse_comments_template', function( $atts = array(), $content = '' )
 {
    if( is_singular() && post_type_supports( get_post_type(), 'comments' ) )
    {
        ob_start();
        comments_template();
        add_filter( 'comments_open',       'wpse_comments_open'   );
        add_filter( 'get_comments_number', 'wpse_comments_number' );
        return ob_get_clean();
    }
    return '';
}, 10, 2 );

function wpse_comments_open( $open )
{
    remove_filter( current_filter(), __FUNCTION__ );
    return false;
}

function wpse_comments_number( $open )
{
    remove_filter( current_filter(), __FUNCTION__ );
    return 0;
}
0 Shares

Become a Toolonomy Community Member for Free!

Consider joining our Official Community Group if you want to get access to the exclusive insider content and information around the Exclusive Business Development Tools. Also, you will be able to get involved in interesting group discussions with like-minded people that are interested in similar topics as you.
Free Membership
Made with ❤ for Digital Entrepreneurs
Copyright © 2018 - 2022 SyncWin | All Rights Reserved.
Top crossmenu
0 Shares
Copy link
Powered by Social Snap