Skip to content

Instantly share code, notes, and snippets.

@isotrope
Created December 8, 2020 20:06
Show Gist options
  • Save isotrope/3c2734d1b5e8fe80280364ec327237d9 to your computer and use it in GitHub Desktop.
Save isotrope/3c2734d1b5e8fe80280364ec327237d9 to your computer and use it in GitHub Desktop.
A few filters used to adjust most of the text regarding comments
<?php
add_filter( 'genesis_post_info', 'tj_post_info_filter' );
function tj_post_info_filter( $post_info ) {
// we didn't want to "count" condolences, so we hacked it slightly to simply ALWAYS say "Leave your condolences"
return '[post_comments zero="Leave your condolences" one="Leave your condolences" more="Leave your condolences"]';
}
add_filter( 'comment_form_defaults', 'tj_comment_form_atts' );
function tj_comment_form_atts( $atts ) {
// this is the submit button text
$atts['label_submit'] = __( 'Leave your condolences' );
// this is the "section" heading
$atts['title_reply'] = __( 'Leave your condolences' );
// this is the "message/comment" textarea field
$atts['comment_field'] = sprintf(
'<p class="comment-form-comment">%s %s</p>',
sprintf(
'<label for="comment">%s</label>',
// this is where you leave the text for the comment textarea fiel dlabel
_x( 'Condolences', 'noun' )
),
'<textarea id="comment" name="comment" cols="45" rows="8" maxlength="65525" required="required"></textarea>'
);
return $atts;
}
// here, we're editing the section's heading
add_filter( 'genesis_title_comments', 'tj_change_comments_section_heading' );
function tj_change_comments_section_heading() {
return '<h2>' . __( 'Condolences' ) . '</h2>';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment