Title: do_shortcode() question!
Last modified: August 22, 2016

---

# do_shortcode() question!

 *  [ravock](https://wordpress.org/support/users/ravock/)
 * (@ravock)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question/)
 * Hello guys!
 * First of all I’m a total beginner ! I have two weeks with wordpress and the same
   with PHP and HTML.
 * So pretty much this code was totally made with effort and trying and not much
   of a technique so I’m sorry if it doesn’t follow the best practices but somehow
   it’s starting to work.
 *     ```
       function test_shortcode(){
       $content = '
       [simple_tooltip content="<strong>Marca Superior de Dano de Ataque:</strong><br />
       Nível: <span style="color: #00ff00">20</span><br />
       <span style="color: #ff0000;">+0.95</span> de Dano de Ataque"]
   
       <img src="http://leagueoflegendsbrasil.com/wp-content/uploads/2014/11/runaataque.png" alt="leagueoflegends" width="50" height="50" />
   
       [/simple_tooltip]';
   
       echo do_shortcode($content);
       }
   
       add_shortcode('test', 'test_shortcode');
       ```
   
 * The problem is that the the image is being showed two times and also the colors
   from the span style are not working.
 * Any hint how to fix that?
 * Thanks in advance
 * _[[bump ](http://codex.wordpress.org/Forum_Welcome#No_Bumping)moderated]_

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

 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question/#post-5535402)
 * What exactly are you trying to do here?
 * That code doesn’t make a whole lot of sense. You would not want a do_shortcode
   call inside a shortcode, for example.
 *  Thread Starter [ravock](https://wordpress.org/support/users/ravock/)
 * (@ravock)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question/#post-5535405)
 * I’m trying to create images with a nice looking tooltips, so I can use the same
   image with the same tooltips in many pages.
 * And in case I need to change some of the information I just change the shortcode
   and not codes all over the site.
 * That’s why the shortcode has a simple and easy to remember name so I can use 
   it easily later since I plan to shortcode lots of different items.
 * For instance the character A,B,C and D use the Item test I created so I simply
   add [test] wherever I want to add the image+tooltip.
 * Thanks.
 *  Thread Starter [ravock](https://wordpress.org/support/users/ravock/)
 * (@ravock)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question/#post-5535444)
 * I edited the code to:
 *     ```
       function test_shortcode(){
       return '
       [simple_tooltip content="<strong>Marca Superior de Dano de Ataque:</strong><br />
       Nível: <span style=&quot;color: #00ff00&quot;>20</span><br />
       <span style=&quot;color: #ff0000;&quot;>+0.95</span> de Dano de Ataque"]
   
       <img src="http://leagueoflegendsbrasil.com/wp-content/uploads/2014/11/runaataque.png" alt="leagueoflegends" width="50" height="50" />
   
       [/simple_tooltip]';
   
       }
   
       add_shortcode('test', 'test_shortcode');
       ```
   
 * Now it only shows one image but still the span style color is not working, can
   someone help me just with that?
 *  Moderator [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * (@otto42)
 * WordPress.org Admin
 * [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question/#post-5535575)
 * You can’t return shortcodes from inside a shortcode. They won’t be processed.

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

The topic ‘do_shortcode() question!’ is closed to new replies.

 * 4 replies
 * 2 participants
 * Last reply from: [Samuel Wood (Otto)](https://wordpress.org/support/users/otto42/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question/#post-5535575)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
