Coder Social home page Coder Social logo

Comments (1)

Jon007 avatar Jon007 commented on September 15, 2024

the simplest fix to this is to change the rendering class-decent-comments-renderer get_comments to use the standard wp_list_comments, here with a conditional option to apply the woocommerce callback. It's not generic to any plugin but it does use the standard functions which any theme should be expecting rather than taking over and doing a separate rendering within the plugin.

      $container_class='decent-comments comments-area';
      if ( class_exists( 'woocommerce' ) ){
        //if woocommerce is activated, use standard woocommerce callback for the display
        //to get the rating and the verified owner where applicable
        //for further customization, see woocommerce single-product/review.php
        $options['callback']='woocommerce_comments';
        apply_filters( 'woocommerce_product_review_list_args', $options );
        //note, apply woocommerce class to get woo CSS formatting for ratings on non-woo page
        $container_class.=' woocommerce';
      }
			$output .= '<div class="' . $container_class . '">';
			$output .= '<ul>';
      $options['echo']=false;
      $output .= wp_list_comments( $options, $comments);
      $output .= '</ul>';
			$output .= '</div>'; // .decent-comments

Notes:

  • works fine for products and normal posts as is using standard wordpress function
  • in this case the get_comment function in class-decent-comments-renderer is no longer used to output the comment
  • if using woocommerce note that there's a few things that the woocommerce rending doesn't do, like output url for comment, output link from comment date to link back to comment page etc.
    To customize the rendering copy /wp-content/plugins/woocommerce/templates/single-product/review-meta.php to your theme in /woocommerce/single-product and start editing

from decent-comments.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.