Title: A php question
Last modified: August 18, 2016

---

# A php question

 *  [fuzzy_logic](https://wordpress.org/support/users/fuzzy_logic/)
 * (@fuzzy_logic)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/)
 * I don’t know anything about php so I need help from you guys. I need to do something
   like this in the loop:
 * if (comment_number!=0) {
    // do something here }
 * The question is, how do code the test condition?
    Thanks in advance!

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

 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/#post-179322)
 * This might be what you’re looking for: [http://codex.wordpress.org/Template_Tags/comments_number](http://codex.wordpress.org/Template_Tags/comments_number)
 *  Thread Starter [fuzzy_logic](https://wordpress.org/support/users/fuzzy_logic/)
 * (@fuzzy_logic)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/#post-179323)
 * I tried that actually, but it displays the number, instead of returning it as
   a value.
 *  Moderator [James Huff](https://wordpress.org/support/users/macmanx/)
 * (@macmanx)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/#post-179324)
 * Hm, even if you set it as `<p>This post currently has <?php comments_number('
   no responses','one response','% responses');Â ?>.</p>` ?
 *  [Mark Jaquith](https://wordpress.org/support/users/markjaquith/)
 * (@markjaquith)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/#post-179326)
 * You can look at `$comment_count_cache[$post->ID]` for that. It should be populated
   for you.
 *  Thread Starter [fuzzy_logic](https://wordpress.org/support/users/fuzzy_logic/)
 * (@fuzzy_logic)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/#post-179391)
 * Thanks guys. I’ll try that later to see if it works. I might be back with more
   questions though. =)
 *  Thread Starter [fuzzy_logic](https://wordpress.org/support/users/fuzzy_logic/)
 * (@fuzzy_logic)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/#post-179576)
 * markjaquith: It worked like a charm. But I’m just wondering, how would I find
   such tags? I mean how am I supposed to knwo it if it’s not in the Codex?
    Thanks
   again!
 *  [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * (@alphaoide)
 * [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/#post-179578)
 * You have to open the related file and peruse the source code yourself, and examine
   what does what and how.

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

The topic ‘A php question’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 7 replies
 * 4 participants
 * Last reply from: [Joshua Sigar](https://wordpress.org/support/users/alphaoide/)
 * Last activity: [21 years, 2 months ago](https://wordpress.org/support/topic/a-php-question/#post-179578)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
