How To Add Hooks For Comment Plus Plugin

Hello,

I have changed my theme on the website, and Comments Plus no longer works.

I am unsure where to add the “hooks” at in my code?

Code attached in text file…

Thanks!

  • twoverun
    • WPMU DEV Initiate

    Can’t attach the .txt for some reason…

    <?php

    // Do not delete these lines

    if (!empty($_SERVER) && ‘comments.php’ == basename($_SERVER))

    die (‘Please do not load this page directly. Thanks!’:wink:;

    if ( post_password_required() ) { ?>

    <p class=”nocomments”><?php _e(‘Password protected.’, ‘themejunkie’:wink:; ?></p>

    <?php

    return;

    }

    ?>

    <!– You can start editing here. –>

    <div class=”comments-box”>

    <?php if ( have_comments() ) : ?>

    <h3><?php comments_number(__(‘No Responses’, ‘themejunkie’:wink:, __(‘One Response’, ‘themejunkie’:wink:, __(‘% Responses’, ‘themejunkie’:wink: );?> <?php _e(‘to’, ‘themejunkie’:wink: ?> “<?php the_title(); ?>”</h3>

    <ol class=”commentlist”>

    <?php wp_list_comments(‘avatar_size=48’:wink:; ?>

    <div class=”navigation”>

    <div class=”left”><?php previous_comments_link() ?></div>

    <div class=”right”><?php next_comments_link() ?></div>

    <div class=”clear”></div>

    </div> <!–end .pagination–>

    <?php else : // this is displayed if there are no comments so far ?>

    <?php if (‘open’ == $post->comment_status) : ?>

    <!– If comments are open, but there are no comments. –>

    <?php else : // comments are closed ?>

    <!– If comments are closed. –>

    <?php endif; ?>

    <?php endif; ?>

    <?php if (‘open’ == $post->comment_status) : ?>

    <div id=”respond”>

    <h3><?php _e(‘Leave a Reply’, ‘themejunkie’:wink:; ?></h3>

    <div class=”cancel-comment-reply”>

    <small><?php cancel_comment_reply_link(); ?></small>

    </div> <!–end .cancel-comment-reply–>

    <?php if ( get_option(‘comment_registration’:wink: && !$user_ID ) : ?>

    <p><?php _e(‘You must be’, ‘themejunkie’:wink: ?> /wp-login.php?redirect_to=<?php echo urlencode(get_permalink()); ?>”><?php _e(‘Logged in’, ‘themejunkie’:wink: ?> <?php _e(‘to post comment’, ‘themejunkie’:wink: ?>.</p>

    <?php else : ?>

    <form action=”<?php echo get_option(‘siteurl’:wink:; ?>/wp-comments-post.php” method=”post” id=”commentform”>

    <?php if ( $user_ID ) : ?>

    <p><?php _e(‘Logged as’, ‘themejunkie’:wink: ?> /wp-admin/profile.php”><?php echo $user_identity; ?>. ” title=”Log out of this account”><?php _e(‘Log out’, ‘themejunkie’:wink: ?> »</p>

    <?php else : ?>

    <p>

    <input type=”text” name=”author” class=”txt” id=”author” value=”<?php echo $comment_author; ?>” size=”22″ tabindex=”1″ />

    <label for=”author”><?php _e(‘Name’, ‘themejunkie’:wink: ?> <?php if ($req) ?> (<?php _e(‘Required’, ‘themejunkie’:wink:; ?>:wink: <?php ; ?></label>

    </p>

    <p>

    <input type=”text” name=”email” class=”txt” id=”email” value=”<?php echo $comment_author_email; ?>” size=”22″ tabindex=”2″ />

    <label for=”email”><?php _e(‘Mail (will not be published)’, ‘themejunkie’:wink: ?> <?php if ($req) ?> (<?php _e(‘Required’, ‘themejunkie’:wink:; ?>:wink: <?php ; ?></label>

    </p>

    <p>

    <input type=”text” name=”url” class=”txt” id=”url” value=”<?php echo $comment_author_url; ?>” size=”22″ tabindex=”3″ />

    <label for=”url”><?php _e(‘Website’, ‘themejunkie’:wink: ?></label>

    </p>

    <?php endif; // End if logged in ?>

    <!–<p>XHTML: <?php _e(‘You can use these tags’, ‘themejunkie’:wink:; ?>: <?php echo allowed_tags(); ?></p>–>

    <p><textarea name=”comment” id=”comment” rows=”10″ cols=”50″ tabindex=”4″></textarea></p>

    <input name=”submit” type=”submit” id=”submit” class=”button” tabindex=”5″ value=”<?php _e(‘Submit Comment’, ‘themejunkie’:wink: ?>” />

    <input type=”hidden” name=”comment_post_ID” value=”<?php echo $id; ?>” />

    <?php comment_id_fields(); ?>

    <?php do_action(‘comment_form’, $post->ID); ?>

    </form> <!–end #commentform–>

    <?php endif; // If registration required and not logged in ?>

    </div> <!–end #respond–>

    <?php endif; // if you delete this the sky will fall on your head ?>

    </div> <!–end #comment-box–>

  • DavidM
    • DEV MAN’s Mascot

    Hi twoverun,

    Yeah, if you could provide the theme name in the future, that’ll help us find that for you as well, but I can see the relevant hook in the code you posted, as follows:

    comment_form

    You should be able to use ‘comment_form’ as the hook in probably both the before and after fields in Comments Plus.

    Could you let us know how that goes?

    Thanks,

    David

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.