Support » Plugin: Mihdan: Ajax Edit Comments » Plugin Does Not Work With My Theme

  • Hello, I am biggest fan of your plugin but my problem is that, it is not working with my new theme… 🙁 so sad. Nothing happens when I install and activate the plugin, though it is working well with other default WordPress themes.

    In the comment.php of new theme, they used the code like this below:

    <?php
    $feather_theme_options = get_option('feather');
    $form_message = isset( $feather_theme_options['commentformmessage'] ) ? $feather_theme_options['commentformmessage'] : __('Please be polite. We appreciate that.<br /> Your email address will not be published and required fields are marked' , 'dsf');
    if($form_message == '') $form_message = __('Please be polite. We appreciate that.<br /> Your email address will not be published and required fields are marked' , 'dsf');
    ?>
    <!-- comments -->
    <div class="comments post-inner-content secondary-content-box">
    
            <!-- content box inner -->
            <div class="content-box-inner">
    
            <?php if(post_password_required()) : ?>
    
            <h4><?php echo __('Post Protected' , 'dsf'); ?></h4>
    
            </div>
            <!-- end comments -->
    
            <?php else : ?>
    
            <?php 
    
            // list the comments
            if(have_comments()) {
    
              ?>
                <h4 id="comments"><?php
                  $comments_n = __('No Comments', 'dsf');
                  $comments_o = __('1 Comment', 'dsf');
                  $comments_r = __('% Comments', 'dsf');
                  comments_number($comments_n, $comments_o, $comments_r ); ?></h4>
    <div class="comment list">
        <?php ds_list_comments(array('avatar_size' => 60,'style' => 'div')); ?>
    </div>
    
              <?php
    
                wp_list_comments(array('type' => 'comment' , 'style' => 'div' , 'callback' => 'ds_list_comments'));
    
                // get comments count and check if pagination required
                if(dsf_check_comments(get_the_ID()) === 'true' ) :
                ?>
                  <div class="clearfix"></div>
                  <span class="prev"> <?php previous_comments_link('Older Comments'); ?></span>
                  <span style="float: right;" class="next"> <?php next_comments_link('Newer Comments'); ?></span>
    
                <?php endif; // end check comments pagination  
    
            }else{
    
               ?>
    
                <h4 id="comments" style="margin-bottom: 0px;"><?php
                  $comments_n = __('No Comments', 'dsf');
                  $comments_o = __('1 Comment', 'dsf');
                  $comments_r = __('% Comments', 'dsf');
                  comments_number($comments_n, $comments_o, $comments_r ); ?></h4>
    
               <?php
            } ?>
    
            </div>
            <!-- end content box inner -->
    
    </div>
    <!-- end comments -->
    
    <!-- comments form -->
    <div id="respond" class="post-inner-content comments-form secondary-content-box">
    
                    <div class="content-box-inner">
    
                    <?php if(comments_open()) : ?>
                    <h4><?php _e('Leave a Comment' , 'dsf'); ?></h4>
    
                    <?php if(get_option('comment_registration') == 1 && !is_user_logged_in()) : ?>
    
                    <p><?php echo __('Only registerd members can post a comment, ' , 'dsf'); ?><a href="<?php echo wp_login_url(get_permalink());  ?>"><?php echo __('Login or Register' , 'dsf'); ?></a></p>
    
                    <?php else : ?>
    
                    <?php
                    /**
                     * [$comment_form_args custom comment form fields]
                     * @var array
                     */
                    $reqs = '';
                    if($req) $reqs = '('.__('required').')'; else $reqs = '';
                    $commenter = wp_get_current_commenter();
                    $comment_form_args = array(
                        'id_form' => 'commentform',
                        'comment_notes_before' => '<p class="light-font">' . $form_message
                        . '</p>' ,
                        'comment_notes_after' => '',
                        'id_submit' => 'submit-comment',
                        'class_submit' => 'submit-comment',
                        'title_reply' => '' ,
                          'title_reply_to' => __( 'Leave a Reply to %s or' , 'dsf' ),
                          'cancel_reply_link' => __( 'Cancel Reply' , 'dsf' ),
                          'label_submit' => __( 'Post Comment' , 'dsf' ),
                          'comment_field' => '<textarea name="comment" id="comment-text" placeholder="'.__('Write Message' , 'dsf').'" class="comment-text"></textarea>' ,
                          'fields' => apply_filters( 'comment_form_default_fields', array(
    
                                        'author' => '<br /><input type="text" value="'.esc_attr( $commenter['comment_author'] ).'" name="author" class="comment-name textfield"  id="comment-name" placeholder="'.__('Your Name *' , 'dsf').'" />' ,
    
                                        'email' => '<input type="text" value="'. esc_attr(  $commenter['comment_author_email'] ).'" name="email" class="comment-email textfield"  id="comment-email" placeholder="'.__('Your Email *' , 'dsf').'" />' ,
    
                                        'website' => '<input type="text" value="'. esc_attr(  $commenter['comment_author_url'] ).'" name="url" class="comment-website textfield"  id="comment-website" placeholder="'.__('Your Website ' , 'dsf').'" />'
    
                                      ) )
                      );
    
                    comment_form($comment_form_args);  ?>
    
                    <?php endif; ?>
    
                    <?php else : ?>
                    <h2><?php echo __('Comments Closed' , 'dsf'); ?></h2>
                    <?php endif; // end if comments closed ?>
    
                    </div>
                    <!-- end content box inner -->
    
    </div>
    <!-- end comments form -->
    
    <?php endif; ?>

    ds_list_comments is define in function.php to alter the default settings of comment listing. Here is the code of comments in function.php

    /* --------------------------------------------------------------
          Comments
          -------------------------------------------------------------- */
          function ds_list_comments($comment , $args , $depth)
          {
    
            $GLOBALS['comment'] = $comment;
            extract($args);
    
            ?>
    
                <!-- single comment -->
                <div id="<?php echo get_comment_ID(); ?>" class="single-comment  <?php if($depth > 1) echo 'sub-comment'; ?>
                <?php echo implode(' ' , get_comment_class('Depth')); ?>" id="comment-id-<?php comment_ID(); ?>">
    
                <!-- avatar -->
                <div class="avatar"><?php echo get_avatar( $comment->comment_author_email, 54 ); ?></div>
    
                <!-- comment content -->
                <div class="comment-content">
    
                  <h4><a href="<?php
                      if($comment->user_id > 0)
                      {
                          echo get_author_posts_url($comment->user_id); 
    
                      }elseif(get_comment_author_url() != '')
                      {
                          echo get_comment_author_url();
                      }
                      else{
                          echo '#';
                      }
    
                      ?>"><?php echo $comment->comment_author; ?></a></h4>
                    <span class="comment-date"><?php
                          echo __('about ' , 'dsf') . human_time_diff( get_comment_date('U'), current_time('timestamp') ) . ' ago'; ?></span>
    
                    <div class="comment-body">
                          <?php if($comment->comment_approved == 0) : ?>
                          <p><?php echo __('Your comment is awaiting moderation' , 'dsf'); ?></p>
                          <?php else : ?>
                          <p><?php echo apply_filters('the_content', $comment->comment_content); ?></p>
                          <?php endif; ?>
    
                          <?php comment_reply_link(array_merge( $args, array('depth' => $depth, 'max_depth' => $args['max_depth']))); ?>
                    </div>
                    <!-- end comment body -->
    
                </div>
                <!-- end comment content -->
    
              <?php
          }
    
    // fix comments reply button
    add_filter('comment_reply_link', 'replace_reply_link_class');
    
    function replace_reply_link_class($class){
        $class = str_replace("class='comment-reply-link", "class='reply button", $class);
        return $class;
    }

    Please help me how to make it working with this system.

    https://wordpress.org/plugins/wp-ajax-edit-comments/

  • The topic ‘Plugin Does Not Work With My Theme’ is closed to new replies.