Customizing the comments in the Customizr theme

⚠️ Code snippets might not be compatible with the latest version of your theme. Always use a child theme to customize your theme, and test your code on a staging website before migrating to production.

There are several ways to override the default comments view of the Customizr WordPress theme.

 

1) Overriding the comments.php template with a child theme.

You can make a copy  of the comments.php file of the theme, paste it into your child theme and add custom code there. The Child theme template will override the initial file.

 

2) Working with hooks : recommended

 

add_action('wp_head', 'my_comments_actions');
function my_comments_actions(){
  /* do nothing if the class isn't referenceable, e.g. api changed */
  if ( ! class_exists('TC_comments') )
      return;
  /* Your custom actions below */
  remove_action ( '__after_loop', array( TC_comments::$instance , 'tc_comments' ), 10 );
  add_action( '__after_loop', 'my_comment_callback');
}

 

  • Remove the action calling the template in class-content-commments.php and replace it by another action (code above)
  • Hook in the built-in comment_form() function with the  ‘comment_form’ action hook
  • Use the comments hooks of the theme listed in the hooks API reference of the Customizr : tc_comment_title, tc_comment_list, tc_comment_navigation, tc_comment_close, tc_set_comment_title

10 thoughts on “Customizing the comments in the Customizr theme”

Comments are closed.