Skip to content

Instantly share code, notes, and snippets.

@themeblvd
Last active August 29, 2015 14:04
Show Gist options
  • Save themeblvd/ffc37a9781abc30374db to your computer and use it in GitHub Desktop.
Save themeblvd/ffc37a9781abc30374db to your computer and use it in GitHub Desktop.
This filter on to put $args passed into comment_form() in comments.php of the theme to match what was set prior to framework 2.5. This will make updating older themes easier, so we don't have to update their comment form styling.
<?php
/**
* Put comment args back the way they were prior to framework 2.5
*/
function theme_comment_form_args( $args, $commenter, $req, $aria_req ) {
$commenter = wp_get_current_commenter();
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$args = array(
'fields' => array(
'author' => '<p class="comment-form-author"><input id="author" class="form-control" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' />' .
'<label for="author">' . themeblvd_get_local( 'name' ) . ( $req ? '<span class="required">*</span>' : '' ) . '</label></p>',
'email' => '<p class="comment-form-email"><input id="email" class="form-control" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' />' .
'<label for="email">' . themeblvd_get_local( 'email' ) . ( $req ? '<span class="required">*</span>' : '' ) . '</label></p>',
'url' => '<p class="comment-form-url"><input id="url" class="form-control" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" />' .
'<label for="url">' .themeblvd_get_local( 'website' ) . '</label></p>'
),
'comment_field' => '<p class="comment-form-comment"><textarea id="comment" class="form-control" name="comment" cols="45" rows="10" aria-required="true"></textarea></p>',
'title_reply' => themeblvd_get_local( 'title_reply' ),
'title_reply_to' => themeblvd_get_local( 'title_reply_to' ),
'cancel_reply_link' => themeblvd_get_local( 'cancel_reply_link' ),
'label_submit' => themeblvd_get_local( 'label_submit' )
);
return $args;
}
add_filter( 'themeblvd_comment_form', 'theme_comment_form_args', 10, 4 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment