You can change the standard ‘Leave a Reply’ or ‘Speak Your Mind’ text displayed before every comment form.
This code enables you to customize each comment reply title for posts in different categories.
Here’s the PHP code (that works in any theme) which you need to copy from the the view raw link in the Gist and paste at the end of your child themes functions.php file.
Simply add your category i.d or category slug within the brackets of the conditional tags then rinse and repeat to add more categories.
The way this code is written provides the most efficient and fastest way for the PHP processor on your server to parse this code.
There are other ways to write conditional tags with else if and elseif statements, however this is both the easiest and best method based on testing according to feedback on php.net.
Why hack core template file code when you can use filters in your child themes functions file.
Leave a Reply
You must be logged in to post a comment.