WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Editing Comment Form Labels (7 posts)

  1. prayersnapples
    Member
    Posted 1 year ago #

    I tried changing the text next to one of my comment form entry boxes (Instead of 'Mail (will not be published)' I wanted to insert different text, but it didn't work. Here's where I went in and edited (I replaced the 'Mail....' text with my own - but when I tested it, I got an error message on the site where the comment form usually shows):

    <p><input type="text" class="rounded" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" />
    <label for="email"><small><?php _e('Mail (will not be published)');?> <?php if ($req) _e('(required)'); ?></small></label></p>

    Is there something else I should be changing?

    My site is: http://www.prayersandapples.com

  2. prayersnapples
    Member
    Posted 1 year ago #

    Also, is there a way to delete the email box field completely? I think it's deterring a lot of people from leaving comments because they're in a rush/worried they're going to end up on some sort of mailing list, etc.

  3. prayersnapples
    Member
    Posted 1 year ago #

    I found this site, which offers the same type of advice I've found from Googling:

    http://ottopress.com/2010/wordpress-3-0-theme-tip-the-comment-form/

    It all seems really complicated (I'm not very tech-savy) and I'm just hoping there's an easier way - all I want to do is change a couple words: 'Mail (will not be published)'.

    I've found earlier threads on here, but they all seem similar to the information in the link above. Any simpler solutions?

  4. esmi
    Forum Moderator
    Posted 1 year ago #

    Nope. That's about as simple as it gets.

  5. prayersnapples
    Member
    Posted 1 year ago #

    I don't understand, because I did it before without doing all of that? The heading of the comment form used to say "Leave a comment" and I just deleted that text and changed it to "What is your opinion?" and it worked. It was when I first started my site several months ago, and I was reading a ton of support forum articles, so I honestly don't remember exactly how I did it or where I had to go - but I know 100% it wasn't anything like what that link said. It was basically just deleting and inserting what text I wanted. But now when I locate that "What is your opinion?" text in my commments.php and try to change it, the changes won't show! I'm really confused by this. Here's my comments.php:

    <?php
    // Do not delete these lines
    	if (!empty($_SERVER['SCRIPT_FILENAME']) && 'comments.php' == basename($_SERVER['SCRIPT_FILENAME']))
    		die ('Thanks to not load this page directly.');
    
    if ( post_password_required() ) : ?>
    <p><?php _e('Enter your password to view comments.'); ?></p>
    <?php return; endif; ?>
    
    <aside id="comments">
    <?php if ( have_comments() ) : ?>
    	<h2><?php comments_number(__('No comments'), __('1 Comment'), __('% Comments')); ?>
    <?php if ( comments_open() ) : ?>
    	<a href="#postcomment" title="<?php _e("Leave a comment"); ?>">&raquo;</a>
    <?php endif; ?></h2>
    
    	<div class="pages">
    		<div class="left"><?php previous_comments_link() ?></div>
    		<div class="right"><?php next_comments_link() ?></div>
    	</div>
    
    	<ol class="commentlist">
    	<?php foreach ($comments as $comment) : ?>
            <li class="<?php echo $oddcomment; ?>" id="comment-<?php comment_ID() ?>">
            <div class="quote">
            <?php
                    if(function_exists('get_avatar'))
                        echo get_avatar(get_comment_author_email(), '35');
                ?>
    		<?php comment_text() ?></div>
            <?php if ($comment->comment_approved == '0') : ?>
            <em>Your comment is awaiting moderation.</em>
            <?php endif; ?>
            </li>
            <cite><?php comment_author_link() ?> on <a href="#comment-<?php comment_ID() ?>" title=""><?php comment_date('F jS, Y') ?> at <?php comment_time() ?> <?php edit_comment_link('edit','&nbsp;&nbsp;',''); ?></a></cite>
        <?php endforeach; /* end for each comment */ ?>
        </ol>  
    
    	<div class="pages">
    		<div class="left"><?php previous_comments_link() ?></div>
    		<div class="right"><?php next_comments_link() ?></div>
    	</div>
     <?php else : // this is displayed if there are no comments so far ?>
    
    	<?php if ( comments_open() ) : ?>
    		<!-- If comments are open, but there are no comments. -->
            <p><?php _e('Start a conversation!'); ?></p>
    
    	 <?php else : // comments are closed ?>
    		<!-- If comments are closed. -->
    		<p class="nocomments">Comments are closed.</p>
    
    	<?php endif; ?>
    <?php endif; ?>
    </aside>
    
    <?php if ( comments_open() ) : ?>
    
    <div id="respons">
    
    <h2><?php comment_form_title( 'What is your opinion?' ); ?></h2>
    
    <div class="cancel-comment-reply">
    	<small><?php cancel_comment_reply_link(); ?></small>
    </div>
    
    <?php if ( get_option('comment_registration') && !is_user_logged_in() ) : ?>
    <p>You must be  <a href="<?php echo wp_login_url( get_permalink() ); ?>">connected</a> to post a comment.</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>Logged in as <a href="<?php echo get_option('siteurl'); ?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>. <a href="<?php echo wp_logout_url(get_permalink()); ?>" title="Log out.">Log out &raquo;</a></p>
    
    <?php else : ?>
    
    <p><input type="text" class="rounded" name="author" id="author" value="<?php echo esc_attr($comment_author); ?>" size="22" tabindex="1" />
    <label for="author"><small><?php _e('Name'); ?> <?php if ($req) _e('(required)'); ?></small></label></p>
    
    <p><input type="text" class="rounded" name="email" id="email" value="<?php echo esc_attr($comment_author_email); ?>" size="22" tabindex="2" />
    <label for="email"><small><?php _e('Mail (will not be published)');?> <?php if ($req) _e('(required)'); ?></small></label></p>
    
    <p><input type="text" class="rounded" name="url" id="url" value="<?php echo esc_attr($comment_author_url); ?>" size="22" tabindex="3" />
    <label for="url"><small><?php _e('Website'); ?></small></label></p>
    
    <?php endif; ?>
    
    <!--<p><small><strong>XHTML:</strong> <?php printf(__('You can use these tags: %s'), allowed_tags()); ?></small></p>-->
    
    <p><textarea name="comment" class="rounded" id="comment" cols="60" rows="10" tabindex="4"></textarea></p>
    
    <p><input name="submit" class="rounded" type="submit" id="submit" tabindex="5" value="<?php esc_attr_e('Submit Comment'); ?>" />
    <?php comment_id_fields(); ?>
    </p>
    <?php do_action('comment_form', $post->ID); ?>
    
    </form>
    
    <?php endif; // If registration required and not logged in ?>
    </div>
    
    <?php endif; // if you delete this the sky will fall on your head ?>
    </aside>
  6. prayersnapples
    Member
    Posted 1 year ago #

    Here's the article that describes how I initially changed it:

    http://www.ehow.com/how_8466872_change-leave-reply-wordpress.html

    But now it doesn't work?

  7. prayersnapples
    Member
    Posted 1 year ago #

    I figured it out! All you have to do (at least on my theme) is going into comments.php and switch out the text you want (as described in the link above). And then (...and this is why it wasn't working for me) you have to delete caches if you're using WP Super Cache (which I wasn't using when I first started my blog - which is why it worked then but didn't seem to work now). Once you delete those, your changes will show! :) I changed the text for the comment form header and for the text next to the email field.

Topic Closed

This topic has been closed to new replies.

About this Topic