Created
June 30, 2015 12:45
-
-
Save manchumahara/c9a73d8d299aba0acda5 to your computer and use it in GitHub Desktop.
for bahar
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Filters the WordPress comment_form() function that was added in WordPress 3.0. This allows | |
* the theme to preserve some backwards compatibility with its old comment form. It also allows | |
* users to build custom comment forms by filtering 'comment_form_defaults' in their child theme. | |
* | |
* @since 0.8.0 | |
* @access public | |
* @param array $args The default comment form arguments. | |
* @return array $args The filtered comment form arguments. | |
*/ | |
function supreme_comment_form_args( $args ) { | |
global $user_identity; | |
/* Get the current commenter. */ | |
$commenter = wp_get_current_commenter(); | |
/* Create the required <span> and <input> element class. */ | |
$req = ( ( get_option( 'require_name_email' ) ) ? ' <span class="required">' . __( '*', 'supreme-core' ) . '</span> ' : '' ); | |
$input_class = ( ( get_option( 'require_name_email' ) ) ? ' req' : '' ); | |
/* Sets up the default comment form fields. */ | |
$fields = array( | |
'author' => '<p class="form-author' . esc_attr( $input_class ) . '"><label for="author">' . __( 'Name', 'supreme-core' ) . $req . '</label> <input type="text" class="text-input" name="author" id="author" value="' . esc_attr( $commenter['comment_author'] ) . '" size="40" /></p>', | |
'email' => '<p class="form-email' . esc_attr( $input_class ) . '"><label for="email">' . __( 'Email', 'supreme-core' ) . $req . '</label> <input type="text" class="text-input" name="email" id="email" value="' . esc_attr( $commenter['comment_author_email'] ) . '" size="40" /></p>', | |
'url' => '<p class="form-url"><label for="url">' . __( 'Website', 'supreme-core' ) . '</label><input type="text" class="text-input" name="url" id="url" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="40" /></p>' | |
); | |
/* Sets the default arguments for displaying the comment form. */ | |
$args = array( | |
'fields' => apply_filters( 'comment_form_default_fields', $fields ), | |
'comment_field' => '<p class="form-textarea req"><label for="comment">' . __( 'Comment', 'supreme-core' ) . '</label><textarea name="comment" id="comment" cols="60" rows="10"></textarea></p>', | |
'must_log_in' => '<p class="alert">' . sprintf( __( 'You must be <a href="%1$s" title="Log in">logged in</a> to post a comment.', 'supreme-core' ), wp_login_url( get_permalink() ) ) . '</p><!-- .alert -->', | |
'logged_in_as' => '<p class="log-in-out">' . sprintf( __( 'Logged in as <a href="%1$s" title="%2$s">%2$s</a>.', 'supreme-core' ), admin_url( 'profile.php' ), esc_attr( $user_identity ) ) . ' <a href="' . wp_logout_url( get_permalink() ) . '" title="' . esc_attr__( 'Log out of this account', 'supreme-core' ) . '">' . __( 'Log out »', 'supreme-core' ) . '</a></p><!-- .log-in-out -->', | |
'comment_notes_before' => '', | |
'comment_notes_after' => '', | |
'id_form' => 'commentform', | |
'id_submit' => 'submit', | |
'title_reply' => __( 'Leave a Reply', 'supreme-core' ), | |
'title_reply_to' => __( 'Leave a Reply to %s', 'supreme-core' ), | |
'cancel_reply_link' => __( 'Click here to cancel reply.', 'supreme-core' ), | |
'label_submit' => __( 'Post Comment', 'supreme-core' ), | |
'submit_button' => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />', | |
'submit_field' => '<p class="form-submit">%1$s %2$s</p>' | |
); | |
/* Return the arguments for displaying the comment form. */ | |
return $args; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment