Last Updated: January 28, 2019
·
1.199K
· dtommasino

Custom WordPress Comments

If you want to fully customize the look and feel comments section of your WordPress theme you can use a callback function in your comments.php file.

Somewhere in your comments.php use the following:

<?php wp_list_comments( 'callback=some_function' ); ?>

Now in your functions.php file create the function you defined above:

function some_function( ) {

Add custom html / php code here
Call the comment methods for each detail (getavatar, commenttext, etc.)

}

1 Response
Add your response

Wordpress should really look into using OOP hooks like MyBB does. It would be so much easier.

over 1 year ago ·

Have a fresh tip? Share with Coderwall community!

Post
Post a tip
Related Tags
#wordpress
Did you know?

WordPress sites collect scripts from themes, plugins, and tag managers. A compromised plugin update can add a skimmer to every page without a change in your own templates.

Security insights from Cside