Advertisement
jegtheme

comments.php

May 4th, 2015
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 4.66 KB | None | 0 0
  1. <?php  
  2.     if ( post_password_required() ) {
  3.         echo '<p class="nopassword">' . j__( 'comment_password_protected_lang') . '</p>';
  4.         return ;
  5.     }
  6.    
  7.    
  8.     function j_comment_form($i) {
  9.        
  10.         $commenter = wp_get_current_commenter();
  11.         $user = wp_get_current_user();
  12.         $user_identity = $user->exists() ? $user->display_name : '';
  13.        
  14.         $req = get_option( 'require_name_email' );
  15.         $aria_req = ( $req ? " aria-required='true'" : '' );
  16.        
  17.         $i['author'] =  '<p class="comment-form-author"><span class="comment-author-wrapper">' . '<label for="author">' . j__( 'name_lang' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
  18.                         '<input id="author" name="author" type="text" value="' . esc_attr( $commenter['comment_author'] ) . '" size="30"' . $aria_req . ' /></span></p>';
  19.         $i['email']  =  '<p class="comment-form-email"><label for="email">' . j__( 'comment_email_lang' ) . '</label> ' . ( $req ? '<span class="required">*</span>' : '' ) .
  20.                         '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30"' . $aria_req . ' /></p>';
  21.         $i['url']    =  '<p class="comment-form-url"><label for="url">' . j__( 'comment_website_lang' ) . '</label>' .
  22.                         '<input id="url" name="url" type="text" value="' . esc_attr( $commenter['comment_author_url'] ) . '" size="30" /></p>';
  23.          
  24.         return $i;
  25.     }
  26.    
  27.     add_action('comment_form_default_fields', 'j_comment_form');
  28.    
  29.    
  30.     function j_comment_default_form($defaults)
  31.     {
  32.        
  33.         global $id;
  34.         $post_id = $id;
  35.                
  36.         $commenter = wp_get_current_commenter();
  37.         $user = wp_get_current_user();
  38.         $user_identity = $user->exists() ? $user->display_name : '';
  39.        
  40.         $req = get_option( 'require_name_email' );
  41.         $required_text = sprintf( ' ' . j__( 'comment_required_field_lang' , 'Required fields are marked %s' ) , '<span class="required">*</span>' );
  42.        
  43.         $newdefaults = array(
  44.             'fields'               => $defaults['fields'],
  45.             'comment_field'        => '<p class="comment-form-comment"><label for="comment">' . j__('comment_textarea_lang', 'Comment') . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>',
  46.             'must_log_in'          => '<p class="must-log-in">' . sprintf( j__( 'login_to_comment_lang' ), wp_login_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',
  47.             'logged_in_as'         => '<p class="logged-in-as">' . sprintf( j__( 'new_login_as_lang' ), admin_url( 'profile.php' ), $user_identity, wp_logout_url( apply_filters( 'the_permalink', get_permalink( $post_id ) ) ) ) . '</p>',           
  48.             'comment_notes_before' => '<p class="comment-notes">' . j__( 'comment_email_not_publish_lang' ) . ( $req ? $required_text : '' ) . '</p>',
  49.             'comment_notes_after'  => '<p class="form-allowed-tags">' . sprintf( j__( 'comment_markup_lang' ), ' <code>' . allowed_tags() . '</code>' ) . '</p>',
  50.             'id_form'              => 'commentform',
  51.             'id_submit'            => 'submit',
  52.             'title_reply'          => j__( 'comment_leave_reply_lang' ),
  53.             'title_reply_to'       => j__( 'comment_leave_reply_to_lang' ),
  54.             'cancel_reply_link'    => j__( 'comment_cancel_reply_lang' ),
  55.             'label_submit'         => j__( 'comment_post_comment_lang' ),
  56.             'submit_button'        => '<input name="%1$s" type="submit" id="%2$s" class="%3$s" value="%4$s" />',
  57.             'submit_field'         => '<p class="form-submit">%1$s %2$s</p>',
  58.             'class_submit'         => 'submit',
  59.             'name_submit'          => 'submit',
  60.         );
  61.        
  62.         return $newdefaults;
  63.     }
  64.    
  65.     add_action('comment_form_defaults', 'j_comment_default_form');
  66.    
  67.     if ( comments_open() ) :
  68. ?>
  69. <div class="comment-container" id="comments">
  70. <?php   if(have_comments()) :   ?>
  71.     <h2><?php comments_number(j__( 'no_comment_lang' ), j__( 'one_comment_lang' ), j__( 'more_comment_lang' ) ); ?></h2>
  72.     <hr/>
  73.     <div id="comment-content-container">
  74.         <ul class="commentlist">
  75.             <?php wp_list_comments(array(
  76.                 'type'          => 'all',
  77.                 'callback'      => apply_filters('jeg_comment_callback', 'jeg_comment'),
  78.                 'avatar_size'   => '80'
  79.             )); ?>
  80.         </ul>
  81.        
  82.         <div class="comment-navigation navigation" >
  83.             <div class='alignleft' style="margin-bottom: 20px;">
  84.                 <?php next_comments_link('<span>&laquo;</span> Previous') ?>
  85.             </div>
  86.             <div class='alignright' style="margin-bottom: 20px;">
  87.                 <?php previous_comments_link('Next<span>&raquo;</span>') ?>
  88.             </div>
  89.         </div>
  90.        
  91.     </div>
  92. <?php  
  93.     endif; // comment list
  94.    
  95.     if ( get_option('comment_registration') && !is_user_logged_in() ) :
  96.         j_e('login_comment_lang');
  97.     else :         
  98.         comment_form();
  99.     endif; // comment form
  100. ?>
  101. </div>
  102. <?php          
  103.     endif; // if comment open
  104. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement