Some customizations I made for the comments section in my custom Genesis Child theme.
These are specific for the Genesis Framework – StudioPress Themes for WordPress (affiliate link). I will post general customizations of the comments section when I find them.
A two part series on using Code Snippets in Genesis.
Part 2: Customizing the blog post previews and posts page of a Genesis child theme.
Customizing the words used in the comments section.
The following are adjustments of various phrases used in the comments section.
The code is to be added to the child theme functions.php file.
Adjusting the comment box title from “Leave a Reply” -> “Leave a Comment”
// Add or remove notes after the comment box | |
// | |
add_filter( 'comment_form_defaults', 'sp_remove_comment_form_allowed_tags' ); | |
function sp_remove_comment_form_allowed_tags( $defaults ) { | |
$defaults['comment_notes_after'] = 'An extra comment'; | |
return $defaults; | |
} |
// Modify the Genesis content limit read more link – Genesis Settings page – Display post content certain amount of characters. I selected 200. | |
// | |
add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); | |
function sp_read_more_link() { | |
return '… <a class="more-link" href="' . get_permalink() . '">[Read on]</a>'; | |
} |
// Modify the speak your mind title in comments – Comment Box title – | |
// | |
add_filter( 'comment_form_defaults', 'sp_comment_form_defaults' ); | |
function sp_comment_form_defaults( $defaults ) { | |
$defaults['title_reply'] = __( 'Leave a Comment' ); | |
return $defaults; | |
} |
// Changing the mini Comment title to something else http://wpsites.net/web-design/customize-comment-field-text-area-label/ | |
// | |
function wpsites_modify_comment_form_text_area($arg) { | |
$arg['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . _x( 'Your feedback is appreciated!', 'noun' ) . '</label><textarea id="comment" name="comment" cols="55" rows="7" aria-required="true"></textarea></p>'; | |
return $arg; | |
} | |
add_filter('comment_form_defaults', 'wpsites_modify_comment_form_text_area'); |
// Thanks to Jo at http://www.jowaltham.com/customising-comment-date-genesis/ | |
// In reply: Remove time and link inside the date field. | |
// | |
add_filter( 'genesis_show_comment_date', 'jmw_remove_comment_time_and_link' ); | |
function jmw_remove_comment_time_and_link( $comment_date ) { | |
printf( '<p %s>', genesis_attr( 'comment-meta' ) ); | |
printf( '<time %s>', genesis_attr( 'comment-time' ) ); | |
echo esc_html( get_comment_date() ); | |
echo '</time></p>'; | |
// Return false so that the parent function doesn't also output the comment date and time | |
return false; | |
} |
Changing the mini title just above the comment box from “Comment” -> “Your feedback is appreciated!”
// Add or remove notes after the comment box | |
// | |
add_filter( 'comment_form_defaults', 'sp_remove_comment_form_allowed_tags' ); | |
function sp_remove_comment_form_allowed_tags( $defaults ) { | |
$defaults['comment_notes_after'] = 'An extra comment'; | |
return $defaults; | |
} |
// Modify the Genesis content limit read more link – Genesis Settings page – Display post content certain amount of characters. I selected 200. | |
// | |
add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); | |
function sp_read_more_link() { | |
return '… <a class="more-link" href="' . get_permalink() . '">[Read on]</a>'; | |
} |
// Modify the speak your mind title in comments – Comment Box title – | |
// | |
add_filter( 'comment_form_defaults', 'sp_comment_form_defaults' ); | |
function sp_comment_form_defaults( $defaults ) { | |
$defaults['title_reply'] = __( 'Leave a Comment' ); | |
return $defaults; | |
} |
// Changing the mini Comment title to something else http://wpsites.net/web-design/customize-comment-field-text-area-label/ | |
// | |
function wpsites_modify_comment_form_text_area($arg) { | |
$arg['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . _x( 'Your feedback is appreciated!', 'noun' ) . '</label><textarea id="comment" name="comment" cols="55" rows="7" aria-required="true"></textarea></p>'; | |
return $arg; | |
} | |
add_filter('comment_form_defaults', 'wpsites_modify_comment_form_text_area'); |
// Thanks to Jo at http://www.jowaltham.com/customising-comment-date-genesis/ | |
// In reply: Remove time and link inside the date field. | |
// | |
add_filter( 'genesis_show_comment_date', 'jmw_remove_comment_time_and_link' ); | |
function jmw_remove_comment_time_and_link( $comment_date ) { | |
printf( '<p %s>', genesis_attr( 'comment-meta' ) ); | |
printf( '<time %s>', genesis_attr( 'comment-time' ) ); | |
echo esc_html( get_comment_date() ); | |
echo '</time></p>'; | |
// Return false so that the parent function doesn't also output the comment date and time | |
return false; | |
} |
Adjusts the “Post Comment” button text -> “Submit”
// Add or remove notes after the comment box | |
// | |
add_filter( 'comment_form_defaults', 'sp_remove_comment_form_allowed_tags' ); | |
function sp_remove_comment_form_allowed_tags( $defaults ) { | |
$defaults['comment_notes_after'] = 'An extra comment'; | |
return $defaults; | |
} |
// Modify the Genesis content limit read more link – Genesis Settings page – Display post content certain amount of characters. I selected 200. | |
// | |
add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); | |
function sp_read_more_link() { | |
return '… <a class="more-link" href="' . get_permalink() . '">[Read on]</a>'; | |
} |
// Modify the speak your mind title in comments – Comment Box title – | |
// | |
add_filter( 'comment_form_defaults', 'sp_comment_form_defaults' ); | |
function sp_comment_form_defaults( $defaults ) { | |
$defaults['title_reply'] = __( 'Leave a Comment' ); | |
return $defaults; | |
} |
// Changing the mini Comment title to something else http://wpsites.net/web-design/customize-comment-field-text-area-label/ | |
// | |
function wpsites_modify_comment_form_text_area($arg) { | |
$arg['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . _x( 'Your feedback is appreciated!', 'noun' ) . '</label><textarea id="comment" name="comment" cols="55" rows="7" aria-required="true"></textarea></p>'; | |
return $arg; | |
} | |
add_filter('comment_form_defaults', 'wpsites_modify_comment_form_text_area'); |
// Thanks to Jo at http://www.jowaltham.com/customising-comment-date-genesis/ | |
// In reply: Remove time and link inside the date field. | |
// | |
add_filter( 'genesis_show_comment_date', 'jmw_remove_comment_time_and_link' ); | |
function jmw_remove_comment_time_and_link( $comment_date ) { | |
printf( '<p %s>', genesis_attr( 'comment-meta' ) ); | |
printf( '<time %s>', genesis_attr( 'comment-time' ) ); | |
echo esc_html( get_comment_date() ); | |
echo '</time></p>'; | |
// Return false so that the parent function doesn't also output the comment date and time | |
return false; | |
} |
Add or remove an extra comment below the comments box.
I added the text -> An extra comment. This is just to show that it exists.
// Add or remove notes after the comment box | |
// | |
add_filter( 'comment_form_defaults', 'sp_remove_comment_form_allowed_tags' ); | |
function sp_remove_comment_form_allowed_tags( $defaults ) { | |
$defaults['comment_notes_after'] = 'An extra comment'; | |
return $defaults; | |
} |
// Modify the Genesis content limit read more link – Genesis Settings page – Display post content certain amount of characters. I selected 200. | |
// | |
add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); | |
function sp_read_more_link() { | |
return '… <a class="more-link" href="' . get_permalink() . '">[Read on]</a>'; | |
} |
// Modify the speak your mind title in comments – Comment Box title – | |
// | |
add_filter( 'comment_form_defaults', 'sp_comment_form_defaults' ); | |
function sp_comment_form_defaults( $defaults ) { | |
$defaults['title_reply'] = __( 'Leave a Comment' ); | |
return $defaults; | |
} |
// Changing the mini Comment title to something else http://wpsites.net/web-design/customize-comment-field-text-area-label/ | |
// | |
function wpsites_modify_comment_form_text_area($arg) { | |
$arg['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . _x( 'Your feedback is appreciated!', 'noun' ) . '</label><textarea id="comment" name="comment" cols="55" rows="7" aria-required="true"></textarea></p>'; | |
return $arg; | |
} | |
add_filter('comment_form_defaults', 'wpsites_modify_comment_form_text_area'); |
// Thanks to Jo at http://www.jowaltham.com/customising-comment-date-genesis/ | |
// In reply: Remove time and link inside the date field. | |
// | |
add_filter( 'genesis_show_comment_date', 'jmw_remove_comment_time_and_link' ); | |
function jmw_remove_comment_time_and_link( $comment_date ) { | |
printf( '<p %s>', genesis_attr( 'comment-meta' ) ); | |
printf( '<time %s>', genesis_attr( 'comment-time' ) ); | |
echo esc_html( get_comment_date() ); | |
echo '</time></p>'; | |
// Return false so that the parent function doesn't also output the comment date and time | |
return false; | |
} |
If you need to remove the time and link inside the date field this is one way of doing so.
// Add or remove notes after the comment box | |
// | |
add_filter( 'comment_form_defaults', 'sp_remove_comment_form_allowed_tags' ); | |
function sp_remove_comment_form_allowed_tags( $defaults ) { | |
$defaults['comment_notes_after'] = 'An extra comment'; | |
return $defaults; | |
} |
// Modify the Genesis content limit read more link – Genesis Settings page – Display post content certain amount of characters. I selected 200. | |
// | |
add_filter( 'get_the_content_more_link', 'sp_read_more_link' ); | |
function sp_read_more_link() { | |
return '… <a class="more-link" href="' . get_permalink() . '">[Read on]</a>'; | |
} |
// Modify the speak your mind title in comments – Comment Box title – | |
// | |
add_filter( 'comment_form_defaults', 'sp_comment_form_defaults' ); | |
function sp_comment_form_defaults( $defaults ) { | |
$defaults['title_reply'] = __( 'Leave a Comment' ); | |
return $defaults; | |
} |
// Changing the mini Comment title to something else http://wpsites.net/web-design/customize-comment-field-text-area-label/ | |
// | |
function wpsites_modify_comment_form_text_area($arg) { | |
$arg['comment_field'] = '<p class="comment-form-comment"><label for="comment">' . _x( 'Your feedback is appreciated!', 'noun' ) . '</label><textarea id="comment" name="comment" cols="55" rows="7" aria-required="true"></textarea></p>'; | |
return $arg; | |
} | |
add_filter('comment_form_defaults', 'wpsites_modify_comment_form_text_area'); |
// Thanks to Jo at http://www.jowaltham.com/customising-comment-date-genesis/ | |
// In reply: Remove time and link inside the date field. | |
// | |
add_filter( 'genesis_show_comment_date', 'jmw_remove_comment_time_and_link' ); | |
function jmw_remove_comment_time_and_link( $comment_date ) { | |
printf( '<p %s>', genesis_attr( 'comment-meta' ) ); | |
printf( '<time %s>', genesis_attr( 'comment-time' ) ); | |
echo esc_html( get_comment_date() ); | |
echo '</time></p>'; | |
// Return false so that the parent function doesn't also output the comment date and time | |
return false; | |
} |
A comment box example using the modifications I listed above:
/*———– Author box and Gravatar From https://briangardner.com/code/ ————-*/
Add a h1 tag around the authors name.
//* Change the author box title add_filter( 'genesis_author_box_title', 'bg_custom_author_box__title' ); function bg_custom_author_box__title() { return 'Paal Joachim Romdahl'; } //* Customize the Gravatar size in the author box add_filter( 'genesis_author_box_gravatar_size', 'bg_author_box_gravatar' ); function bg_author_box_gravatar( $size ) { return '105'; }
Resources used:
– https://my.studiopress.com/snippets/comments/
– https://wpsites.net/web-design/customize-comment-field-text-area-label/
– https://wpspeak.com/remove-post-date-in-genesis-framework/
– https://wpsites.net/wordpress-tips/show-posts-with-most-comments-first-on-your-home-page/
– https://www.jowaltham.com/customising-comment-date-genesis/
– https://wpsites.net/web-design/genesis-add-comment-bubble-with-counter-to-entry-meta/
I Want To Change Colour Scheme And Box Design Of My Sites Comment Section. Currently, I M Using Genesis Framework, Education Pro Child Theme. Can You Suggest Me Some Plugins As I Have Only Little Coding Knowledge.
Thank You Joachim.
I’ll be honest with you.
I’m not a pro WordPress user. I started my blog recently and I’m still learning things.
I should say learning things from scratch.
And I found it requires some ‘coding’ knowledge if you need to do customizations to your WordPress installations.
And guides/tutorials like this will surely help people like me who needs some customizations (Not only for a commenting system, but also for almost all the look of the WordPress website)
Thank You and Keep sharing!
Thanks a lot very easy for me to add on my html site
Excellent teaching
Thanks, this really helped me understand the options of the DamBuster plugin. I was watching another video and it was about a plugin called Fullwidth that does the same thing but without all the meta options of the DamBuster plugin. Have you compared the two with any pros and cons?
Hey RVNeed
I have not yet looked at DamBuster https://wordpress.org/plugins/genesis-dambuster/
or Fullwidth plugins: https://wordpress.org/plugins/fullwidth-templates/
I am adding both the links here so others can check it out.
How to delete date information in each comment. I can not delete it, all instructions are directed to css display none. Thank you
Needed to compose you a very little word to thank you yet again regarding the nice suggestions you’ve contributed here.Appreciating the persistence you put into your blog and detail information you provide.
|java training in Velachery,Chennai
Good article!!!
Dth Hammers Bits Manufacturers in India
Thanks for this great post. I’ve bookmarked your site, and I’m adding your RSS feeds to my Google account.
Part 2 series link is not working
Genesis has been my go to framework/theme for the past 4 yrs I actually learned how to play with wordpress really in depth with it
I have now corrected the link. Thank you for letting me know.
This website will really help everyone in providing the tools and information necessary for the people to develop and improve their website
I felt very relaxed after reading your post. I was searching something to get some info about wordpress design. Your post fulfilled my search. I am very thankful.
I was very pleased to search out this web-site.I needed to thanks on your time for this glorious learn!! I positively having fun with every little little bit of it and I’ve you bookmarked to take a look at new stuff you blog post.
Thanks for this
Nice article
Thanks so much. helped a lot.
Good stuff. Just used this to modify my comments text in the Media Pro Genesis theme. Thanks so much for sharing this!
Thank you for your post. It worked for me.
Nice informative post about customize of WordPress site.Bangalore web experts which is very good blog.You will find all details about design of any kind of website .
Thank you but in many cases I prefer Joomla.
Respects
Hi Amir
Why is that?
Excellent tips, I am going to perform these task practically. Thanks for sharing.
Hi,
Thanks for sharing this this will halp a lot of web developers.Thanks for sharing
Thanks for your sharing
Your site always shares many useful articles that always helps.
Thank you Shane!
When leaving the above comment, I got the following error, thought you might want to know. It still submitted, but left me sitting at a blank page with just the following.
Warning: call_user_func_array() expects parameter 1 to be a valid callback, class ‘SC_Advanced_Cache’ does not have a method ‘purge_post_on_new_comment’ in /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/plugin.php on line 525
Warning: Cannot modify header information – headers already sent by (output started at /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/plugin.php:525) in /home/paaljoac/public_html/easywebdesigntutorials.com/wp-content/plugins/simple-comment-editing/index.php on line 820
Warning: Cannot modify header information – headers already sent by (output started at /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/plugin.php:525) in /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/comment.php on line 517
Warning: Cannot modify header information – headers already sent by (output started at /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/plugin.php:525) in /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/comment.php on line 518
Warning: Cannot modify header information – headers already sent by (output started at /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/plugin.php:525) in /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/comment.php on line 519
Warning: Missing argument 2 for SC_Advanced_Cache::set_comment_cookie_exceptions() in /home/paaljoac/public_html/easywebdesigntutorials.com/wp-content/plugins/simple-cache/inc/class-sc-advanced-cache.php on line 29
Warning: Cannot modify header information – headers already sent by (output started at /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/plugin.php:525) in /home/paaljoac/public_html/easywebdesigntutorials.com/wp-content/plugins/simple-cache/inc/class-sc-advanced-cache.php on line 36
Warning: Cannot modify header information – headers already sent by (output started at /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/plugin.php:525) in /home/paaljoac/public_html/easywebdesigntutorials.com/wp-includes/pluggable.php on line 1171
I think I know what the problem is and will need to take care of this very soon.
Thanks for the heads up Julie!
Thanks you, exactly what I was looking for. to change “Leave a Reply”. Worked perfectly 🙂
I also wanted different wording for different pages, so added
add_filter( ‘comment_form_defaults’, ‘sp_comment_form_defaults’ );
function sp_comment_form_defaults( $defaults ) {
if (get_the_ID() == 94) {
$defaults[‘title_reply’] = __( ‘Leave a Review’ );
} else {
$defaults[‘title_reply’] = __( ‘Leave a Comment’ );
}
return $defaults;
}
Thanks for adding the additional code Julie!
I might also add it to the tutorial to show an example on using different phrases/words on different pages.
Have a great day!
Excellent ! Thank you so much for sharing great post.
Hi.Paal Joachim Romdahl
Wow Excellent post! Thank you so much for sharing great post.
Great post. I am experiencing some of these problems as well..
Thanks for the instructions, really helped, a lot!!
Thank you 1 000 000 times 🙂
Hi,
sorry I can not understand how you have achieved this:
The button text top right of the post says Leave a Comment. I changed it to Add a Comment.
can you help me?
Sara
Hi Sara
Thank you for asking!
I noticed I had not added the code for the button.
I have now gone through the article and also written another article on customizing the post preview and post page.
https://www.easywebdesigntutorials.com/customizing-the-blog-post-previews-and-posts-page-of-a-genesis-child-theme/
I added the code to adjust the phrase in the comment button there.
Happy New Year!
Thanks!
Sara
What creative insight for an often neglected area of the web page
Hi, I want to show only day, month and year in the comment meta, without a link and time stamp. Can you tell me how to do that? Thanks for the tutorials.
Edit:
A very good idea, Ayesha! Thank you for asking how to remove the time and date link! I asked in the Slack channel for Genesis. https://genesiswp.slack.com/messages/code-snippets/
Jo replied and also made the following article: https://www.jowaltham.com/customising-comment-date-genesis/ I have added the code in the 2nd to last of the Github Gists (as can be seen above).
Excellent tutorial! There’s so much that one can do make the comment section come alive. Thanks!
I need to know for a presentation i am doing for school. I can’t find any decent information on advent calendars and how they came about? can anyone help?
What is child theme function? Actually am new to this and i want to learn more about it. I got your point but I just want some clarification on this function for brief knowledge.
Hi Amparo
Thank you for asking!
One of the files inside the parent theme folder is functions.php which contains specific code for the theme.
When I create a child theme I usually copy the style.css and the functions.php and add it to the new child theme folder.
I have an older tutorial that mentions the why and how to create a child theme.
https://www.easywebdesigntutorials.com/creating-a-child-theme/
I appreciate the tutorial, as this is exactly what I need for configuring comments for a custom post type. One question: the plugin as used (with WP 3.5) gives the following error when a comment is submitted: “You have taken too long. Please go back and refresh the page.” Any ideas what would cause this?
Very nice tutorial. Thanks!
Hi Samara. It seems your speaking about the comment edit plugin I am using called Simple Comment Editing https://wordpress.org/plugins/simple-comment-editing/
I can not recall right now.
Have a great day!
i am also agree to your post and this is very helpful
This is very helpful post to do make comment section.
Thanks
The overriding question I have is, for us non-developers, how do we know what to put where? How do we know what to change and what to leave alone? Looking at the snippets provided by Brian and you, how do we know what is necessary and what is not?
Looking at your comment section, it is EXACTLY what I want but don’t know how to implement the code.
Thank you for taking the time to read this and reply.
Michael
Hi Michael
Just try out one code section at a time. See for yourself what changes.
Some code go into the child theme functions.php file other code goes into the style.css file. (I mention above where to place what).
Do let me know what is unclear about the article and I can adjust.
Thank you for your donation! It is appreciated!
Have a great day!
I tried your code and realized you had written it for a Genesis Theme and I am trying to use Divi (though I am not sure that is the right platform for a blog). Do I just change the Genesis tags with Divi or is there something else I need to do. I DO know that the folks at Elegant Themes have done some “interesting” mods to the WordPress platform.
Regards
Hey Michael
I sent support at Elegant Themes a question about customizing comments.
There response: “I’m afraid we do not currently have any information on customizing the style/layout of comments available on our blog or documentation. We’ll certainly consider publishing an article on the topic in the future though! :)”
Paal Joachim
Excellent post. I am facing some of these issues as well..
Thank you for the sharing the information.
I always check your site since I bookmarked it recently for some wordpress tutorials. I have really learn a lot about customization of comment area. Thanks for sharing.