WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Comment Page Gap (7 posts)

  1. William Speruzzi
    Member
    Posted 6 years ago #

    Whenever a reader wants to go to my "add a comment" page from an individual post the page leaves a massive gap between the comments form and the Submit button. Is there any code I can add or extract from my CSS (or any other solution) to close that gap and put the Submit button and the other meta right under the comment form?

    Here is my blog.

    Thanks.

  2. Jeremy Clark
    Moderator
    Posted 6 years ago #

    There is some code in you comment template that you can change.

    <p class="subscribe-to-comments" style="clear:both;">

    just delete the style information so it looks like this.

    <p class="subscribe-to-comments">

  3. William Speruzzi
    Member
    Posted 6 years ago #

    Jeremy -

    I'm not seeing that code in my comment template. This is what I have (please advise):

    <?php // Do not delete these lines

    if ('comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    die ('Please do not load this page directly. Thanks!');

    if (!empty($post->post_password)) { // if there's a password
    if ($_COOKIE['wp-postpass_' . COOKIEHASH] != $post->post_password) { // and it doesn't match the cookie
    ?>

    <p class="center"><?php _e("This post is password protected. Enter the password to view comments."); ?><p>

    <?php return; } }

    /* Function for seperating comments from track- and pingbacks. */
    function k2_comment_type_detection($commenttxt = 'Comment', $trackbacktxt = 'Trackback', $pingbacktxt = 'Pingback') {
    global $comment;
    if (preg_match('|trackback|', $comment->comment_type))
    return $trackbacktxt;
    elseif (preg_match('|pingback|', $comment->comment_type))
    return $pingbacktxt;
    else
    return $commenttxt;
    }

    $templatedir = get_bloginfo('template_directory');

    $comment_number = 1;
    ?>

    <!-- You can start editing here. -->

    <?php if (($comments) or ('open' == $post-> comment_status)) { ?>

    <div id="comments">

    <h3 class="comments_header"><?php comments_number('0 Comments', '1 Comments', '% Comments' );?> </h3>

    <ul id="comment_list">

    <?php if ($comments) { ?>

    <?php $count_pings = 1; $counter=1; foreach ($comments as $comment) { ?>

    <li class="comment <?php if (k2_comment_type_detection() != "Comment") { echo('trackback'); } ?> <?=$oddcomment?>" id="comment-<?php comment_ID() ?>">
    ">
    <p class="comment_meta">
    <?php echo "#" . $counter . ".   "; ?><?php comment_author_link() ?>
    <span> " alt="Permalink to this comment"><?php comment_date('m.d.Y') ?></span>
    </p>
    <div class="entry">
    <?php comment_text() ?>
    <?php if ($comment->comment_approved == '0') : ?>
    <p>Your comment is awaiting moderation.</p>
    <?php endif; ?>
    </div>

    <?php /* Changes every other comment to a different class */
    if ('alt' == $oddcomment) $oddcomment = '';
    else $oddcomment = 'alt';

    $counter++;
    ?>

    <?php } /* end for each comment */ ?>

    <?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. -->
    <li class="comment">
    <div class="entry">
    <p>There are no comments yet, be the first by filling in the form below.</p>
    </div>

    <?php } else { // comments are closed ?>

    <!-- If comments are closed. -->

    <?php if (is_single) { // To hide comments entirely on Pages without comments ?>
    <li class="comment">
    <div class="entry">
    <p>Comments are closed.</p>
    </div>

    <?php } ?>

    <?php } ?>

    <?php } ?>

    <!-- Comment Form -->
    <?php if ('open' == $post-> comment_status) : ?>

    <?php if ( get_option('comment_registration') && !$user_ID ) : ?>

    <p class="unstyled">You must /wp-login.php?redirect_to=<?php the_permalink(); ?>">log in to post a comment.</p>

    <?php else : ?>

    <h3 id="respond" class="comments_header">Leave a Comment</h3>
    <form action="<?php echo get_option('siteurl'); ?>/wp-comments-post.php" method="post" id="comment_form">

    <?php if ( $user_ID ) { ?>

    <p class="unstyled">Logged in as /wp-admin/profile.php"><?php echo $user_identity; ?>. /wp-login.php?action=logout" title="<?php _e('Log out of this account') ?>">Logout »</p>

    <?php } ?>
    <?php if ( !$user_ID ) { ?>
    <p><label for="author">* Name:</label><input class="text_input" type="text" name="author" id="author" value="<?php echo $comment_author; ?>" tabindex="1" /></p>
    <p><label for="email">* Mail:</label><input class="text_input" type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>" tabindex="2" /></p>
    <p><label for="url">Website:</label><input class="text_input" type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>" tabindex="3" /></p>
    <?php } ?>
    <!--<p><small>XHTML: You can use these tags: <?php echo allowed_tags(); ?></small></p>-->

    <p><label for="comment">* Your Comments:</label><textarea class="text_input text_area" name="comment" id="comment" rows="7" tabindex="4"></textarea></p>

    <?php if (function_exists('show_subscription_checkbox')) { show_subscription_checkbox(); } ?>

    <p><input name="submit" class="form_submit" type="submit" id="submit" src="<?php bloginfo('template_url') ?>/images/submit_comment.gif" tabindex="5" value="Submit" />
    <input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
    </p>

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

    </form>

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

    <?php endif; // if you delete this the sky will fall on your head ?>
    </div> <!-- Close #comments container -->
    <?php } ?>

  4. Jeremy Clark
    Moderator
    Posted 6 years ago #

    Okay that's being caused by you subscribe to comments plugin. If you edit your plugin somewhere in there you'll find what I put in my previous post.

  5. William Speruzzi
    Member
    Posted 6 years ago #

    This is from the subscribe-to-comments plugin template. The only thing that looks similar is what I highlighted:

    <?php
    /*
    Plugin Name: Subscribe To Comments
    Version: 2.1
    Plugin URI: http://txfx.net/code/wordpress/subscribe-to-comments/
    Description: Allows readers to recieve notifications of new comments that are posted to an entry. Based on version 1 from Scriptygoddess
    Author: Mark Jaquith
    Author URI: http://txfx.net/
    */

    /* This is the code that is inserted into the comment form */
    function show_subscription_checkbox ($id='0') {
    global $sg_subscribe;
    sg_subscribe_start();

    if ( $sg_subscribe->checkbox_shown ) return $id;
    if ( !$email = $sg_subscribe->current_viewer_subscription_status() ) : ?>

    <?php /* ------------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for users who are NOT subscribed */ ?>
    <?php /* ------------------------------------------------------------------- */ ?>

    <p <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments">
    <input type="checkbox" name="subscribe" id="subscribe" value="subscribe" style="width: auto;" <?php if ($sg_subscribe->default_subscribed) echo 'checked="checked" '; ?>/>
    <label for="subscribe"><?php echo $sg_subscribe->not_subscribed_text; ?></label>
    </p>

    <?php /* ------------------------------------------------------------------- */ ?>

    <?php elseif ( $email == 'admin' && current_user_can('manage_options') ) : ?>

    <?php /* ------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for the author of the post */ ?>
    <?php /* ------------------------------------------------------------- */ ?>

    <p <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments">
    <?php echo str_replace('[manager_link]', $sg_subscribe->manage_link($email, true, false), $sg_subscribe->author_text); ?>
    </p>

    <?php else : ?>

    <?php /* --------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for users who ARE subscribed */ ?>
    <?php /* --------------------------------------------------------------- */ ?>

    <p <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments">
    <?php echo str_replace('[manager_link]', $sg_subscribe->manage_link($email, true, false), $sg_subscribe->subscribed_text); ?>
    </p>

    <?php /* --------------------------------------------------------------- */ ?>

    <?php endif;

    $sg_subscribe->checkbox_shown = true;
    return $id;
    }

    /* -------------------------------------------------------------------- */
    /* This function outputs a "subscribe without commenting" form. */
    /* Place this somewhere within "the loop", but NOT within another form */
    /* This is NOT inserted automaticallly... you must place it yourself */
    /* -------------------------------------------------------------------- */
    function show_manual_subscription_form() {
    global $id, $sg_subscribe, $user_email;
    sg_subscribe_start();
    $sg_subscribe->show_errors('solo_subscribe', '<div class="solo-subscribe-errors">', '</div>', __('Error: ', 'subscribe-to-comments'), '
    ');

    if ( !$sg_subscribe->current_viewer_subscription_status() ) :
    get_currentuserinfo(); ?>

    <?php /* ------------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for users who are NOT subscribed */ ?>
    <?php /* ------------------------------------------------------------------- */ ?>

    <form action="http://<?php echo $_SERVER['HTTP_HOST'] . wp_specialchars($_SERVER['REQUEST_URI'], 1); ?>" method="post">
    <input type="hidden" name="solo-comment-subscribe" value="solo-comment-subscribe" />
    <input type="hidden" name="postid" value="<?php echo $id; ?>" />
    <input type="hidden" name="ref" value="<?php echo urlencode('http://' . $_SERVER['HTTP_HOST'] . wp_specialchars($_SERVER['REQUEST_URI'], 1)); ?>" />

    <p class="solo-subscribe-to-comments">
    <?php _e('Subscribe without commenting', 'subscribe-to-comments'); ?>

    <label for="solo-subscribe-email"><?php _e('E-Mail:', 'subscribe-to-comments'); ?>
    <input type="text" name="email" id="solo-subscribe-email" size="22" value="<?php echo $user_email; ?>" /></label>
    <input type="submit" name="submit" value="<?php _e('Subscribe', 'subscribe-to-comments'); ?>" />
    </p>
    </form>

    <?php /* ------------------------------------------------------------------- */ ?>

    <?php endif;
    }

    /* -------------------------
    Use this function on your comments display - to show whether a user is subscribed to comments on the post or not.
    Note: this must be used within the comments loop! It will not work properly outside of it.
    ------------------------- */
    function comment_subscription_status() {
    global $comment;
    if ($comment->comment_subscribe == 'Y') {
    return true;
    } else {
    return false;
    }
    }

  6. William Speruzzi
    Member
    Posted 6 years ago #

    Got it! Made the adjustments down the line.

    Thanks Jeremy! I've been trying to fix this one for months!

  7. Jeremy Clark
    Moderator
    Posted 6 years ago #

    It's in this bit of code here.

    <?php /* --------------------------------------------------------------- */ ?>
    <?php /* This is the text that is displayed for users who ARE subscribed */ ?>
    <?php /* --------------------------------------------------------------- */ ?>
    
    <p <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments">
    <?php echo str_replace('[manager_link]', $sg_subscribe->manage_link($email, true, false), $sg_subscribe->subscribed_text); ?>
    </p>

    Before editing anything check your option for your plugin it looks like they have an option to disable the styling. If no then edit this line
    <?php if ($sg_subscribe->clear_both) echo 'style="clear: both;" '; ?>class="subscribe-to-comments">
    delete the style="clear:both;"

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags