Community Forums › Forums › Archived Forums › Design Tips and Tricks › Custom comments.php
Tagged: child theme, comments.php
- This topic has 3 replies, 2 voices, and was last updated 6 years, 6 months ago by
Victor Font.
-
AuthorPosts
-
July 28, 2018 at 10:49 pm #222076July 29, 2018 at 2:19 am #222079
Victor Font
ModeratorI don't think so. The Genesis init process is designed to load core functions from the Genesis directory structure, not the child theme.
In its purest sense, the Genesis Framework is an abstraction layer for WordPress functions. It provides structure through its many WordPress hooks. Hooks are actions and filters.
When you say you want to customize the comments area, doing it the Genesis way generally means either altering the priorities of the hooks or changing what each hook does through your own custom functions. For example, here's a snippet that moves the comments below the comment form. It's a major structural change accomplished with a few lines of code:
add_action( 'genesis_before_comments' , 'move_comments_below_form' ); function move_comments_below_form() { if ( is_single() && have_comments() ) { remove_action( 'genesis_comment_form', 'genesis_do_comment_form' ); add_action( 'genesis_comments', 'genesis_do_comment_form', 5 ); } }
If you can be more specific about what you want to accomplish, maybe someone can point you to the right hooks to achieve the result.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet?July 29, 2018 at 11:02 pm #222097jeremyers1
MemberThanks.
I want to be able to add some details about the author beneath their author gravatar. Specifically, I am using the GamiPress plugin, and want to add the comment authors GamiPress level beneath their avatar image. (Almost exactly as done here on this forum, except instead of "Participant" or "Moderator" I want the GamiPress achievements to show.)
I wrote a bit about it here, but no one replied.
https://www.studiopress.community/topic/add-gamipress-details-below-avatar-in-comment-section/
Blogger and Author
July 30, 2018 at 9:21 am #222113Victor Font
ModeratorWhat you want to do is a little tricky because there aren't any filters in the genesis_html5_comment_callback that will allow you to modify the author area. This means you have to create a couple of custom functions. The first changes the comment defaults to use your second function that replaces genesis_html5_comment_callback.
None of this is tested, but it will give you an idea of what's involved.
add_filter( 'genesis_comment_list_args', 'change_comment_defaults' ); function change_comment_defaults( $defaults ){ $defaults = array( 'type' => 'comment', 'avatar_size' => 48, 'format' => 'html5', // Not necessary, but a good example. 'callback' => genesis_html5() ? 'my_custom_html5_comment_callback' : 'genesis_comment_callback', ); return $defaults; }
Next, copy the genesis_html5_comment_callback function from lib/structure/comments.php into functions.php. Rename it to my_custom_html5_comment_callback, then modify it as you desire.
Don't make these modifications through the WordPress editor. It's too easy to bring your site down.
Make a backup of your site. Use FTP and a local editor to make the changes.
Good luck with this.
Regards,
Victor
https://victorfont.com/
Call us toll free: 844-VIC-FONT (842-3668)
Have you requested your free website audit yet? -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.