Title: help with some php
Last modified: August 18, 2016

---

# help with some php

 *  [esgaroth](https://wordpress.org/support/users/esgaroth/)
 * (@esgaroth)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php/)
 * well i didnt get any responses last time so let me explain this a little more.
   
   im just starting to learn php so i need a little help with it. i added a function
   to the template-functions-author.php file called the_author_image_url. the function
   works fine by itself. now what i need some php that says if the function does
   not contain a value, then do nothing. if it does then display the image. ive 
   tried rewriting it a few different ways but im not doing it right. im sure one
   of you can write it out in a minute. thanks for any help you can give me.

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

 *  Anonymous
 * [21 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php/#post-70111)
 * I’m a little confused by “does not contain a value”. Do you mean a function’s
   attributes? If so, try something like this…
    `function the_author_image_url( 
   $att = NULL ) { if( ! is_null( $att ) ) { // do image stuff, $att was set } }
   I’m not sure if that’s what you meant. Let me know! 🙂
 *  [stevarino](https://wordpress.org/support/users/stevarino/)
 * (@stevarino)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php/#post-70117)
 * oops, that was me… not logged in. 😉
 *  [Root](https://wordpress.org/support/users/root/)
 * (@root)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php/#post-70136)
 * I think he means if there is no authors image.
 *  Thread Starter [esgaroth](https://wordpress.org/support/users/esgaroth/)
 * (@esgaroth)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php/#post-70139)
 * actually the function is allready defined in the template-functions-author.php
   file. the function gets an url that the user has entered into the database. but
   not all users have entered an url. the function looks like this:
    ‘ function 
   the_author_image_url() { global $id,$authordata; echo $authordata->user_image_url;}‘
   i need to call the function in a way that it will not output anything if there
   is nothing in the database to return.
 *  [stevarino](https://wordpress.org/support/users/stevarino/)
 * (@stevarino)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php/#post-70150)
 * Ah, try this then:
    `function the_author_image_url() { global $id,$authordata;
   if( ! is_null( $authordata->user_image_url ) && trim( $authordata->user_image_url)!
   = "" ) { echo $authordata->user_image_url; } } Should work.
 *  Thread Starter [esgaroth](https://wordpress.org/support/users/esgaroth/)
 * (@esgaroth)
 * [21 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php/#post-70152)
 * that works perfectly, thanks!

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

The topic ‘help with some php’ is closed to new replies.

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 6 replies
 * 4 participants
 * Last reply from: [esgaroth](https://wordpress.org/support/users/esgaroth/)
 * Last activity: [21 years, 9 months ago](https://wordpress.org/support/topic/help-with-some-php/#post-70152)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
