• Resolved ScorpSuperTester

    (@scorpsupertester)


    Good day.
    I have a problem with this theme. In this theme don’t work plugin comment attachment. But plugin works with other theme.
    I liked this theme and i don’t want to change it. Help me please.

Viewing 7 replies - 1 through 7 (of 7 total)
  • hannah

    (@hannahritner)

    Hey,
    What plugin are you using? Can you post a link to your site?

    Hannah

    Thread Starter ScorpSuperTester

    (@scorpsupertester)

    I’m use a plugin Comment Attachment, version 1.5.5.
    Unfortunately the site is closed for strangers, I won’t finish work on the site yet.

    I have identified where the problem is. In the file: “../virtue/templates/comments.php”

    To work around prishlost remove part of the code:

    <?php if (comments_open()) : ?>
      <section id="respond">
         <?php if ( did_action( 'jetpack_comments_loaded' ) ) : ?>
        <?php comment_form(); ?>
        <?php else: ?>
        <h3><?php comment_form_title(__('Leave a Reply', 'virtue'), __('Leave a Reply to %s', 'virtue')); ?></h3>
        <p class="cancel-comment-reply"><?php cancel_comment_reply_link(); ?></p>
        <?php if (get_option('comment_registration') && !is_user_logged_in()) : ?>
          <p><?php printf(__('You must be <a href="%s">logged in</a> to post a comment.', 'virtue'), wp_login_url(get_permalink())); ?></p>
        <?php else : ?>
          <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="commentform">
            <?php if (is_user_logged_in()) : ?>
              <p>
    
              </p>
            <?php else : ?>
            <div class="row">
            <?php $fields   =  array(
                'author' => '<div class="col-md-4">' . '<label for="author">' . __('Name', 'virtue') . ( $req ? ' <span class="comment-required">*</span>' : '' ) . '</label> ' .
                            '<input id="author" name="author" type="text" value="' . esc_attr( $comment_author ) . '" ' . ( $req ? 'aria-required="true"' : '') . ' /></div>',
                'email'  => '<div class="col-md-4"><label for="email">' . __( 'Email (will not be published)', 'virtue') . ( $req ? ' <span class="comment-required">*</span>' : '' ) . '</label> ' .
                            '<input type="email" class="text" name="email" id="email" value="' . esc_attr(  $comment_author_email ) . '" ' . ( $req ? 'aria-required="true"' : '') . ' /></div>',
                'url'    => '<div class="col-md-4"><label for="url">' . __( 'Website', 'virtue' ) . '</label> ' .
                            '<input id="url" name="url" type="url" value="' . esc_attr( $comment_author_url ) . '" /></div>',
              );
              $fields = apply_filters( 'comment_form_default_fields', $fields );
              do_action( 'comment_form_before_fields' );
              foreach ( $fields as $name => $field ) {
                echo apply_filters( "comment_form_field_{$name}", $field ) . "\n";
              }
              do_action( 'comment_form_after_fields' );?>
            </div>
            <?php endif; ?>
            <label for="comment"><?php _e('Comment', 'virtue'); ?></label>
            <textarea name="comment" id="comment" class="input-xlarge" rows="5" aria-required="true"></textarea>
            <p><input name="submit" class="kad-btn kad-btn-primary" type="submit" id="submit" value="<?php _e('Submit Comment', 'virtue'); ?>"></p>
            <?php comment_id_fields(); ?>
            <?php do_action('comment_form', $post->ID); ?>
          </form>
        <?php endif; ?>
        <?php endif; ?>
      </section><!-- /#respond -->
    <?php endif; ?>

    And paste a piece of code from another topic:

    <div id="comments" class="<?php echo implode( ' ', apply_filters( 'tc_comments_wrapper_class' , array('comments-area') ) ) ?>" >
    	<?php
    		comment_form();
    		if ( have_comments() && apply_filters( 'tc_display_comment_list', true ) )
    			do_action ( '__comment' );
    	?>
    </div>

    After such action plugin to work, but the form of comments has changed for the worse, and become ugly 🙁
    PS: I apologize for my English

    Do you know what hook the plugin is using? It should be hooking on “comment_form_after_fields” which is a default wordpress action. (and part of the theme).

    Did the plugin author tell you to remove the theme code?

    Kadence Themes

    Thread Starter ScorpSuperTester

    (@scorpsupertester)

    I know that this hook does but the matter is that it doesn’t work.
    Therefore I removed part of a code, and inserted other code on its place.

    However the above-mentioned plugin doesn’t work in Virtue. Therefore I removed part when.

    I suggest rather then removing theme code and ending with a style that is not the themes you contact the plugin author and see what hook they are using. If you can find that out then you can easily update the template without losing styling.

    Kadence Themes

    Thread Starter ScorpSuperTester

    (@scorpsupertester)

    Thanks for the advice. However, I wonder why the plugin does not work with your theme, but works with standard themes.

    If the plugin is hooking on “comment_form()” (which it shouldn’t but sounds like it is) then it wouldn’t work because that function isn’t called when a theme adds in there own comment output. So standard themes don’t have custom comment output. With this theme you do get it.. You can certainly set the template like you did so comment_form is called instead of the custom form but it just means you will lose all the theme styling for the forum.

    My suggests is how to fix this, I’m not at all worried that there is a plugin that doesn’t work themes can’t control what plugins do. I can tell you that if you can find the hook then it wouldn’t be hard make it work.

    Kadence Themes

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Comment attachment’ is closed to new replies.