Title: PHP Help Needed Please
Last modified: August 18, 2016

---

# PHP Help Needed Please

 *  Resolved [andymike](https://wordpress.org/support/users/andymike/)
 * (@andymike)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/php-help-needed-please/)
 * Ok I think I need an “if” PHP statement. I am a real beginner with PHP. I want
   this chunk of code from my comments.php to parse only if there is at least one
   comment:
 * `<h3 class="commentstop"><?php comments_number(__('No Comments'), __('1 Comment'),
   __('% Comments')); ?> 
    <?php if ( comments_open() ) : ?> <a id="leavecomment"
   href="#postcomment" title="<?php _e("Leave a comment"); ?>">Leave A Comment</
   a> <?php endif; ?></h3>
 * So the PHP I need in English:
 * [ IF THERE ARE NO COMMENTS SKIP THIS CODE] [ IF THERE IS AT LEAST 1 COMMENT PARSE
   IT NORMALLY]
 * It should be relatively simple I just don’t know any PHP.
 * Thanks for any help you can give 🙂

Viewing 5 replies - 1 through 5 (of 5 total)

 *  [michael_](https://wordpress.org/support/users/michael_/)
 * (@michael_)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/php-help-needed-please/#post-373607)
 * Try this one:
 * `if ( $comments ) {
    echo 'There is at least one comment'; } else { echo 'No 
   comment here'; }
 *  Thread Starter [andymike](https://wordpress.org/support/users/andymike/)
 * (@andymike)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/php-help-needed-please/#post-373608)
 * Thanks!
 * I actually found some similar PHP later in the comments code that worked perfectly.
   I just used:
 * <?php if ( $comments ) : ?>
 * CODE HERE
 * <?php else : // If there are no comments yet ?>
    <?php endif; ?>
 * Worked like a charm!
 *  [resiny](https://wordpress.org/support/users/resiny/)
 * (@resiny)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/php-help-needed-please/#post-373611)
 * I suck at php. I can hack my way around, but I really need to learn to do custom
   variables for myself…I need stuff like this all the time
 *  [Kafkaesqui](https://wordpress.org/support/users/kafkaesqui/)
 * (@kafkaesqui)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/php-help-needed-please/#post-373614)
 * [http://www.freewebmasterhelp.com/tutorials/php](http://www.freewebmasterhelp.com/tutorials/php)
 * `;)`
 *  [resiny](https://wordpress.org/support/users/resiny/)
 * (@resiny)
 * [20 years, 1 month ago](https://wordpress.org/support/topic/php-help-needed-please/#post-373842)
 * yeah, yeah, I know. I just need the motivation. There are tons of sites out there
   with great tutorials…

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘PHP Help Needed Please’ is closed to new replies.

## Tags

 * [Coding](https://wordpress.org/support/topic-tag/coding/)
 * [if](https://wordpress.org/support/topic-tag/if/)
 * [php](https://wordpress.org/support/topic-tag/php/)

 * 5 replies
 * 4 participants
 * Last reply from: [resiny](https://wordpress.org/support/users/resiny/)
 * Last activity: [20 years, 1 month ago](https://wordpress.org/support/topic/php-help-needed-please/#post-373842)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
