What is Oxygen Builder & WPDiscuz Integration [PHP Snippet]?

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.

  • Published on: June 18, 2021
  • Updated on: June 18, 2021

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://sync.win/KkPa
 */
 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 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Most Voted
Newest Oldest
Inline Feedbacks
View all comments

Related Snippets

Keep exploring and sharpen your Bricks Builder skills with more expert snippets tailored just for you.

Explore More Snippets

CSS Snippet to Add Layered Glow Effect in Bricks Builder

This effect creates a soft, luminous glow surrounding any shape or element by layering blurred duplicates. It adds gentle depth and visual focus without overpowering the design, perfect for giving…

Read Now

CSS Snippet to Add Glassmorphism Effect in Bricks Builder

This effect transforms sections of your website or app into translucent glass, allowing just enough of the background to peek through while gently softening it. The result is a sleek,…

Read Now

Disable WordPress Blog Features with a PHP Code Snippet

This code snippet disables all blog-related features in a WordPress site to ensure it functions purely as a business site without blogging capabilities for the admin or front-end users.

Read Now
  • Connect. Learn. Build Together.

    Become part of the WPnomy family; a vibrant, supportive community where freelancers, designers, and agencies come together to share insights, ask questions, and celebrate wins. Here, you’ll find encouragement, real-world tips, and a network of passionate WordPress users ready to help you grow.

    Join Facebook Community
    • Connect with passionate WordPress users who share your goals and challenges.
    • Access practical tips, insider tricks, and real-world solutions tailored for all skill levels.
    • Share your progress, get feedback, and celebrate your wins with a supportive network.
    • Stay updated on the latest WordPress features, tutorials, and community events.
    • Experience friendly mentorship and no-fluff guidance, making web building easier and more fun.
    WPnomy - Default Featured Image

    Connect. Learn. Build Together.

    Become part of the WPnomy family; a vibrant, supportive community where freelancers, designers, and agencies come together to share insights, ask questions, and celebrate wins. Here, you’ll find encouragement, real-world tips, and a network of passionate WordPress users ready to help you grow.

    Join Facebook Community