|
| 1 | +<div class="comments"> |
| 2 | + <?php if (get_comments_number() > 0): ?> |
| 3 | + <h3>Comments</h3> |
| 4 | + <div> |
| 5 | + <?php wp_list_comments('style=div&callback=daiquiri_comment'); ?> |
| 6 | + </div> |
| 7 | + <?php endif ?> |
| 8 | + |
| 9 | + <p> |
| 10 | + <a href="" id="comment-open-write-link">Write a comment</a> |
| 11 | + <a href="" id="comment-close-write-link">Close comment form</a> |
| 12 | + |
| 13 | + <script> |
| 14 | + $(document).ready(function() { |
| 15 | + if (window.location.hash.indexOf('#comment') != -1 || |
| 16 | + window.location.hash.indexOf('#respond') != -1) { |
| 17 | + |
| 18 | + $('#comment-open-write-link').hide(); |
| 19 | + } else { |
| 20 | + $('#respond').hide(); |
| 21 | + $('#comment-close-write-link').hide(); |
| 22 | + } |
| 23 | + $('#comment-open-write-link').on('click', function() { |
| 24 | + $('#respond').show(); |
| 25 | + $('#comment-open-write-link').hide(); |
| 26 | + $('#comment-close-write-link').show(); |
| 27 | + return false; |
| 28 | + }); |
| 29 | + $('#comment-close-write-link').on('click', function() { |
| 30 | + $('#respond').hide(); |
| 31 | + $('#comment-open-write-link').show(); |
| 32 | + $('#comment-close-write-link').hide(); |
| 33 | + return false; |
| 34 | + }); |
| 35 | + }); |
| 36 | + </script> |
| 37 | + </p> |
| 38 | + |
| 39 | + <?php |
| 40 | + comment_form(array( |
| 41 | + 'title_reply' => 'Write a comment', |
| 42 | + 'comment_notes_after' => '<p class="comment-help><span class="form-allowed-tags">' . sprintf( __( 'You may use these <abbr title="HyperText Markup Language">HTML</abbr> tags and attributes: %s' ), ' <code>' . trim(allowed_tags()) . '</code>' ) . '.</span></p>', |
| 43 | + 'fields' => array( |
| 44 | + 'author' => ' |
| 45 | + <div class="form-group comment-form-author"> |
| 46 | + <label class="control-label" for="inputAuthor">' . __('Name', 'domainreference') . '</label> |
| 47 | + <input id="inputAuthor" class="form-control" name="author" type="text" value="' . esc_attr($commenter['comment_author']) . '" size="30"' . $aria_req . ' /> |
| 48 | + </div>', |
| 49 | + 'email' => ' |
| 50 | + <div class="form-group comment-form-email"> |
| 51 | + <label class="control-label" for="inputEmail">' . __('Email', 'domainreference') . '</label> |
| 52 | + <input id="inputEmail" class="form-control" name="email" type="text" value="' . esc_attr($commenter['comment_author_email']) . '" size="30"' . $aria_req . ' /> |
| 53 | + <span class="help-block">Your email address will not be published.</span> |
| 54 | + </div>', |
| 55 | + 'url' => ' |
| 56 | + <div class="form-group comment-form-url"> |
| 57 | + <label class="control-label" for="inputUrl">' . __('Website', 'domainreference') . ' (not required)</label> |
| 58 | + <input id="inputUrl" class="form-control" name="url" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30"' . $aria_req . ' /> |
| 59 | + </div>' |
| 60 | + ), |
| 61 | + 'comment_field' => ' |
| 62 | + <div class="form-group comment-form-comment"> |
| 63 | + <label class="control-label" for="inputComment">' . _x('Comment', 'noun') . '</label> |
| 64 | + <textarea id="inputComment" class="form-control" name="comment" type="text" value="' . esc_attr($commenter['comment_author_url']) . '" size="30"' . $aria_req . ' rows="8"></textarea> |
| 65 | + </div>', |
| 66 | + 'class_submit' => 'btn btn-primary' |
| 67 | + )); |
| 68 | + ?> |
| 69 | +</div> |
0 commit comments