-
Thank you @Ahmed for this tutorial. I almost switched to BuddyPress until I found this since for my site I need deep integration with those commenter links to the profile. This tutorial was concise and painless. It actually took me less than 5 minutes to implement.
There are a couple things missing, though. You’ve forgotten the instructions about where to find the callback function.
For those of you struggling with this. All themes will have comments.php, in that file you will find wp_comments_list() with a callback. That callback is reaching out to a function located in another file in the theme which contains the HTML template information for the comments section. That function is usually located in functions.php.
To deploy this integration correctly, you should be doing this in a Child Theme. This is important. I won’t go into the reasons why, because there are many. But if you want to integrate UserPro, you need to learn about Child themes.
So, with that said, to enhance ahmed’s tutorial above.
Go to your parent theme’s functions.php and locate the function that is called from the comments.php. Copy the entire function into the functions.php file in your child theme. Mine looked like this: http://pastebin.com/6g0x2STR
Next, rename the function to something unique to you or your theme. I renamed mine from:
function ttrust_comments($comment, $args, $depth) {
to
function mychildtheme_comments($comment, $args, $depth) {
That is just the first line of the function. Then you need to follow Ahmed’s instructions above to modify the function itself. With the small modifications, mine went from the function I linked to above to this: http://pastebin.com/LzvTzC2G If you compare it to the other carefully, you can see the edits I made. I just copy/pasted like Ahmed instructed.
Finally, there is one more step. You’ll need to modify the callback in comments.php. However, again, you cannot do this in the parent theme’s file. Make a copy of the parent theme’s comments.php and put it into your child theme folder. WP will use this to override the parent theme’s file so any changes you make here will take precedence. In the new comments.php file of your child theme you need to change the callback.
In my theme, I changed it from:
<?php wp_list_comments('callback=ttrust_comments'); ?>
to
<?php wp_list_comments('callback=mychildtheme_comments'); ?>
You’ll see that the callback is reaching out for the new function you created in your functions.php file which holds the HTML template information for your comments list.
This integration takes only a few minutes and it is wasteful of Ahmed’s time to send him your files and asking him to modify them. He does give excellent support, but this is a mundane task and easily done by anyone who can read a tutorial. I’d rather that Ahmed has his time to further develop this excellent and provide tutorials and documentation instead of doing tasks that the users here can do themselves. It took me more time to write this post than it did for me to finish this integration.
support me with button from this url https://benhvienphathai.vn/dia-chi-pha-thai-o-thu-duc/
This is the kind of data I’ve for some time been attempting to discover. Much obliged to you for sharing this data.
You must be logged in to reply to this topic.