WordPress.org

Make WordPress Core

Ticket #10910: 10910.default-theme.001.diff

File 10910.default-theme.001.diff, 4.7 KB (added by beaulebens, 12 years ago)

This patch modifies the previous default/Kubrick to use the new comment_form() function, set up to output the same HTML as it did previously, with CSS to make it look the same where necessary. It's not *quite* perfect, but it's very, very close to the same HTML.

  • wp-content/themes/default/style.css

     
    182182        font-family: 'Lucida Grande', Verdana, Arial, Sans-Serif;
    183183        }
    184184
     185#cancel-comment-reply-link {
     186        color: #06C;
     187        font-size: 80%;
     188        display: block;
     189        }
     190       
    185191.commentmetadata {
    186192        font-weight: normal;
    187193        }
  • wp-content/themes/default/comments.php

     
    4545        <?php endif; ?>
    4646<?php endif; ?>
    4747
    48 
    49 <?php if ( comments_open() ) : ?>
    50 
    51 <div id="respond">
    52 
    53 <h3><?php comment_form_title( 'Leave a Reply', 'Leave a Reply to %s' ); ?></h3>
    54 
    55 <div class="cancel-comment-reply">
    56         <small><?php cancel_comment_reply_link(); ?></small>
    57 </div>
    58 
    59 <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
    60 <p>You must be <a href="<?php echo wp_login_url( get_permalink() ); ?>">logged in</a> to post a comment.</p>
    61 <?php else : ?>
    62 
    63 <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
    64 
    65 <?php if ( is_user_logged_in() ) : ?>
    66 
    67 <p>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out of this account">Log out &raquo;</a></p>
    68 
    69 <?php else : ?>
    70 
    71 <p><input type="text" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" <?php if ($req) echo "aria-required='true'"; ?> />
    72 <label for="author"><small>Name <?php if ($req) echo "(required)"; ?></small></label></p>
    73 
    74 <p><input type="text" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" <?php if ($req) echo "aria-required='true'"; ?> />
    75 <label for="email"><small>Mail (will not be published) <?php if ($req) echo "(required)"; ?></small></label></p>
    76 
    77 <p><input type="text" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
    78 <label for="url"><small>Website</small></label></p>
    79 
    80 <?php endif; ?>
    81 
    82 <!--<p><small><strong>XHTML:</strong> You can use these tags: <code><?php echo allowed_tags(); ?></code></small></p>-->
    83 
    84 <p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>
    85 
    86 <p><input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment" />
    87 <?php comment_id_fields(); ?>
    88 </p>
    89 <?php do_action('comment_form', $post->ID); ?>
    90 
    91 </form>
    92 
    93 <?php endif; // If registration required and not logged in ?>
    94 </div>
    95 
    96 <?php endif; // if you delete this the sky will fall on your head ?>
     48<?php
     49// comment_form() output is what is used in Twenty Ten by default, but needs
     50// some modification for Kubrick
     51$req = get_option( 'require_name_email' );
     52$args = array( 'comment_notes_before' => '',
     53                                'comment_notes_after' => '',
     54                                'fields' => array( 'name' => '<p><input type="text" name="author" id="author" value="' . esc_attr( $comment_author ) . '" size="22" tabindex="1" ' . ( $req ? "aria-required='true'" : '' ) . ' />' .
     55                                                                                        '<label for="author"><small>Name ' . ( $req ? "(required)" : '' ) . '</small></label></p>',
     56                                                                        'email' => '<p><input type="text" name="email" id="email" value="' . esc_attr( $comment_author_email ) . '" size="22" tabindex="2" ' . ( $req ? "aria-required='true'" : '' ) . ' />' .
     57                                                                                                '<label for="email"><small>Mail (will not be published) ' . ( $req ? "(required)" : '' ) . '</small></label></p>',
     58                                                                        'url' => '<p><input type="text" name="url" id="url" value="' . esc_attr( $comment_author_url ) . '" size="22" tabindex="3" />' .
     59                                                                                                '<label for="url"><small>Website</small></label></p>',
     60                                                                        'note' => '<!--<p><small><strong>XHTML:</strong> You can use these tags: <code>' . allowed_tags() . '</code></small></p>-->' ),
     61                                'cancel_reply_link' => __( 'Click here to cancel reply.' ),
     62                                'comment_field' => '<p><textarea name="comment" id="comment" cols="58" rows="10" tabindex="4"></textarea></p>',
     63                                'logged_in_as' => '<p class="logged-in-as">' . sprintf( __( 'Logged in as <a href="%s">%s</a>. <a href="%s" title="Log out of this account">Log out &raquo;</a></p>' ),
     64                                                                                                                                                admin_url( 'profile.php' ),
     65                                                                                                                                                $user_identity,
     66                                                                                                                                                wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) )
     67                                                                                                                                        ),
     68                                'label_submit' => __( 'Submit Comment' )
     69                        );
     70comment_form( $args );
     71?>
     72 No newline at end of file