Title: Unable to generate code when using if else
Last modified: August 19, 2016

---

# Unable to generate code when using if else

 *  [vince2006](https://wordpress.org/support/users/vince2006/)
 * (@vince2006)
 * [17 years, 7 months ago](https://wordpress.org/support/topic/unable-to-generate-code-when-using-if-else/)
 * Hello,
 * I have come very close to getting this solved but I must be missing something.
   I am trying to make it so if an author has their AIM name in their profile, that
   a clickable image will be displayed in the sidebar. Everything in this code seems
   to work except that it is not hyperlinking the AIM name – only the php code is
   being hyperlinked.
 * Here is the code:
 *     ```
       '<?php
       if(the_author_aim == ""){
       	echo "";
       } else {
       	echo"<p align=\"center\"><a href=\"aim:Goim?screenname=<?php echo antispambot(get_the_author_aim()); ?>\" title=\"Message Me on AIM Here\"><img src=\"/images/tkk_msg_aim.gif\" width=\"170\" height=\"38\" border=\"0\"></a>
       ";
       }
       ?>'
       ```
   
 * It is supposed to create the hyperlink as: aim:Goim?screename=AuthorsScreenNameHereFromWordPressUserProfile
   but it is actually creating the hyperlink as:
    aim:Goim?screename=<?php echo 
   antispambot(get_the_author_aim()); ?>
 * I know there must be something I am overlooking. Please advise if you can find
   the mistake in my code.
 * If I use the same code (to geth the author’s aim name from their profile) without
   the if / else statements, the code works fine… I am thinking it’s a problem somwhere
   in the echo statement but I am not sure…
 * `'<p align=\"center\"><a href=\"aim:Goim?screenname=<?php echo antispambot(get_the_author_aim());?
   >\" title=\"Message Me on AIM Here\"><img src=\"/images/tkk_msg_aim.gif\" width
   =\"170\" height=\"38\" border=\"0\"></a>'`
 * Thanks!

The topic ‘Unable to generate code when using if else’ is closed to new replies.

## Tags

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

 * 0 replies
 * 1 participant
 * Last reply from: [vince2006](https://wordpress.org/support/users/vince2006/)
 * Last activity: [17 years, 7 months ago](https://wordpress.org/support/topic/unable-to-generate-code-when-using-if-else/)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
