Problem developing Wordpress comments.php form

Asked

Viewed 134 times

0

Hello! I am developing a theme and my form on comments.php is giving error. The rest of the comment file is working right. I am following the book "How To Be a Rockstar Wordpress Designer" as reference and copied the code in its entirety. Follow the code:

<?php if ($post->comment_status == 'open') : ?>
    <h3>Deixe seu comentário</h3>
<?php if (get_option('comment_registration') && !$user_ID) : ?>
    <p>You must be <a href="<?php bloginfo('url');?>/wp-login.php?redirect_to=<?php the_permanentlink();?>">looged in</a> to post a comment.</p>
<?php else : ?>
<form action="<?php bloginfo('url');?>/wp-comments-post.php" method="post" class="comment-form">
<?php if ( $user_ID) : ?>
    <h4>Logged in as<a href="<?php echo get_option('siteurl');?>/wp-admin/profile.php"><?php echo $user_identity; ?></a>
    <a href="<?php echo get_option('siteurl');?>/wp-login.php?action=logout" title="Log out of this account">Logout</a>
    </h4>
<?php else : ?>
    <input type="text" name="author" id="author" value="<?php echo $comment_author; ?>"/>
    <label for="author"><small>bane <?php if ($req) echo "(required)"; ?></small></label>
    <input type="text" name="email" id="email" value="<?php echo $comment_author_email; ?>"/>
    <label for="email"><small>Mail (will not be published)<?php if ($req) echo "(required)"?></small></label>   
    <input type="text" name="url" id="url" value="<?php echo $comment_author_url; ?>"/>
    <label for="url"><small>Website</small></label>
<?php endif; ?>
<textarea name="comment" id="data" cols="60" rows="7" tabindex="4"></textarea>
<input name="submit" type="submit" id="submit" tabindex="5" value="Submit Comment"/>
<input type="hidden" name="comment_post_ID" value="<?php echo $id; ?>" />
<?php do_action('comment_form', $post->ID); ?>
</form> <?php endif; ?>

Grateful from now on.

I am adding an image to illustrate the error, as suggested in the comments: inserir a descrição da imagem aqui

  • I liked the name of the book, it looks very promising. What is the problem that is happening? appears some error? which one?

  • 1

    What error is appearing?

  • Thank you. I added an image to the question to illustrate the error.

  • The error that is flagged in the comments.php file, line 66, according to the image. Add the comments.php code..

  • @devgaspa , line 66 is last, in case '</form> <?php endif; ? >' So I’m confused.

1 answer

1


Expensive,

Add one more <?php endif; ?> at the end of your code, after I noticed the absence, probably this generated the error.

Hug.

  • Thank you very much! It worked! Sorry if my question was too stupid, I’m still very early in PHP. Hug.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.