Title: Unexpected T_IF
Last modified: August 19, 2016

---

# Unexpected T_IF

 *  [thisisedie](https://wordpress.org/support/users/thisisedie/)
 * (@thisisedie)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/unexpected-t_if/)
 * Hiya. I’m using [this](http://wphacks.com/wordpress-code-recent-comments/) to
   get my last comments. I’m trying to add a bit of code so there will only be a“…”
   after the comment body if the comment isn’t shown in its entirety. This is what
   I’m using:
 * `". if ($comment->com_excerpt >85) { echo "..."; } else { echo ""; } ."`
 * which returns “unexpected T_IF”. I’m no PHP expert, just learning all this stuff,
   but I assume this means it doesn’t like the if? Any ideas how to make this work?
 * Thanks.

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

 *  Anonymous User
 * (@anonymized-3085)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/unexpected-t_if/#post-1544420)
 * Does this work?
 *     ```
       $output .= "\n<li>".strip_tags($comment->comment_author)
       .":" . "<a href=\"" . get_permalink($comment->ID) .
       "#comment-" . $comment->comment_ID . "\" title=\"on " .
       $comment->post_title . "\">" . strip_tags($comment->com_excerpt);
       if ($comment->com_excerpt >85) {$output .= "..."; };
       $output .="</a></li>";
       ```
   
 *  Thread Starter [thisisedie](https://wordpress.org/support/users/thisisedie/)
 * (@thisisedie)
 * [15 years, 11 months ago](https://wordpress.org/support/topic/unexpected-t_if/#post-1544422)
 * Nope, it didn’t work but thank you. get the same error. It really doesn’t seem
   to like the “if”. Sigh.

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

The topic ‘Unexpected T_IF’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 2 replies
 * 2 participants
 * Last reply from: [thisisedie](https://wordpress.org/support/users/thisisedie/)
 * Last activity: [15 years, 11 months ago](https://wordpress.org/support/topic/unexpected-t_if/#post-1544422)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
