Title: Problem with echo and return
Last modified: August 20, 2016

---

# Problem with echo and return

 *  [jpmolla](https://wordpress.org/support/users/jpmolla/)
 * (@jpmolla)
 * [13 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo-and-return/)
 * Hello,
    First of all, thanks for your plugin. I really like it.
 * I have used the function userphoto() to define a custom shortcode.
    But I had
   problem with the integration of this function : the result jumps everytime out
   of my div structure.
 * The shortcode function is very simple :
    <?php function photo_shortcode( $atts,
   $content = null ) { extract( shortcode_atts( array( ‘username’ => ”, ‘class’ 
   => ”, ), $atts ) ); return userphoto($username, ‘<div class = “‘ . $class . ‘”
   >’, ‘</div>’, array(‘alt’ => $content)); } add_shortcode( ‘photo’, ‘photo_shortcode’);
 * Then I could use it like that :
    [photo username=”myusername” class=”alignleft”]
   My Alt description[/photo]
 * I didn’t understand why it jumps out of my div structure until I went and see
   into the code of the file user-photo.php of your plugin.
    I know that it should
   be avoided but I have replaced in each function the “echo” with “return”. I don’t
   understand why it has been decided to “echo” the result. It broke the dom structure.
   If I want “echo” it I can do ‘echo userphoto(…)’, don’t you think ? So since 
   I have done this replacement, everythink works fine.
 * So now I am just affraid of future update of your plugin. So I have just few 
   simples questions ; did you code the echo result in purpose ? And do you think
   the echo replacement by “return” in foolish and no possible for next versions?
 * Thanks in advance
 * Jean-Philippe
 * [http://wordpress.org/extend/plugins/user-photo/](http://wordpress.org/extend/plugins/user-photo/)

The topic ‘Problem with echo and return’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/user-photo.svg)
 * [User Photo](https://wordpress.org/plugins/user-photo/)
 * [Support Threads](https://wordpress.org/support/plugin/user-photo/)
 * [Active Topics](https://wordpress.org/support/plugin/user-photo/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/user-photo/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/user-photo/reviews/)

 * 0 replies
 * 1 participant
 * Last reply from: [jpmolla](https://wordpress.org/support/users/jpmolla/)
 * Last activity: [13 years, 7 months ago](https://wordpress.org/support/topic/problem-with-echo-and-return/)
 * Status: not resolved