File: /home/carrerup/.trash/techland/inc/template-parts/comment-parts.php
<?php
/*************************************************
## Post Comment Customization
*************************************************/
// Theme custom comment list
function techland_custom_commentlist($comment, $args, $depth) {
$GLOBALS['comment'] = $comment; ?>
<li <?php comment_class('nt-comment-item'); ?> id="li-comment-<?php comment_ID() ?>">
<div id="comment-<?php comment_ID(); ?>">
<div class="nt-comment-left">
<div class="nt-comment-avatar">
<?php echo get_avatar($comment,$size='70' ); ?>
</div>
<?php if ($comment->comment_approved == '0') : ?>
<em><?php esc_html_e('Your comment is awaiting moderation.', 'techland') ?></em>
<br />
<?php endif; ?>
</div>
<div class="nt-comment-right">
<div class="nt-comment-author comment__author-name"><?php echo get_comment_author_link(); ?></div>
<div class="nt-comment-content nt-theme-content nt-clearfix"><?php comment_text() ?></div>
<div class="nt-comment-date post-meta">
<span class="post-meta__item __date-post"><a href="<?php echo htmlspecialchars( get_comment_link( $comment->comment_ID ) ) ?>"><?php printf(esc_html__('%1$s at %2$s', 'techland'), get_comment_date(), get_comment_time()) ?></a></span>
<?php edit_comment_link(esc_html__('(Edit)', 'techland'),' ','') ?>
<div class="nt-comment-reply-content post-meta__item"><?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))) ?></div>
</div>
</div>
</div>
<?php
}
// Unset URL from comment form
function techland_move_comment_form_below( $fields ) {
$comment_field = $fields['comment'];
unset( $fields['comment'] );
$fields['comment'] = $comment_field;
return $fields;
}
add_filter( 'comment_form_fields', 'techland_move_comment_form_below' );
// Add placeholder for Name and Email
function techland_move_modify_comment_form_fields($fields){
$commenter = wp_get_current_commenter();
$user = wp_get_current_user();
$user_identity = $user->exists() ? $user->display_name : '';
$req = get_option( 'require_name_email' );
$aria_req = ( $req ? " aria-required='true'" : '' );
$html_req = ( $req ? " required='required'" : '' );
$html5 = current_theme_supports( 'html5', 'comment-form' ) ? 'html5' : false;
$fields['author'] = '<div class="row"><div class="col-12 col-lg-4"><div class="input-wrp">' . '<input class="nt-form-input textfield textfield--grey" id="author" placeholder="'.esc_attr__( 'Full Name', 'techland' ).'" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' required />'.'</div></div>';
$fields['email'] = '<div class="col-12 col-lg-4"><div class="input-wrp">' . '<input class="nt-form-input textfield textfield--grey" id="email" placeholder="'.esc_attr__( 'E-mail', 'techland' ).'" name="email" type="text" value="' . esc_attr( $commenter['comment_author_email'] ) .'" size="30"' . $aria_req . ' required/>' .'</div></div>';
$fields['url'] = '<div class="col-12 col-lg-4"><div class="input-wrp">' . '<input class="nt-form-input textfield textfield--grey" id="url" name="url" placeholder="'.esc_attr__( 'Add your website URL', 'techland' ).'" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" required/> ' .'</div></div></div>';
return $fields;
}
add_filter('comment_form_default_fields','techland_move_modify_comment_form_fields');
function techland_modify_comment_form_text_area($arg) {
$arg['comment_field'] = '<div class="input-wrp"><textarea id="comment" class="textfield textfield--grey" name="comment" cols="45" rows="6" aria-required="true" placeholder="'.esc_attr__( 'Comments', 'techland' ).'"></textarea></div>';
return $arg;
}
add_filter('comment_form_defaults', 'techland_modify_comment_form_text_area');
// add class comment form button
function techland_addclass_form_button( $arg ) {
// $arg contains all the comment form defaults
// simply redefine one of the existing array keys to change the comment form
// see http://codex.wordpress.org/Function_Reference/comment_form for a list
// of array keys
// add Foundation classes to the button class
$arg['class_submit'] = 'custom-btn custom-btn--medium custom-btn--style-1';
// return the modified array
return $arg;
}
// run the comment form defaults through the newly defined filter
add_filter( 'comment_form_defaults', 'techland_addclass_form_button' );
// replace reply link
function techland_replace_reply_link_class($class){
$class = str_replace("class='comment-reply-link", "class='nt-comment-reply", $class);
return $class;
}
add_filter('comment_reply_link', 'techland_replace_reply_link_class');