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-2/)
 * 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.
 * I’m trying to create a library so I can easily hook up images and tooltips in
   diverse pages and in case I want to edit the tooltip of them all, I can do that
   in a single place and affect all.
 *     ```
       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
 * [https://wordpress.org/plugins/simple-tooltips/](https://wordpress.org/plugins/simple-tooltips/)

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

 *  Thread Starter [ravock](https://wordpress.org/support/users/ravock/)
 * (@ravock)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question-2/#post-5535439)
 * I changed to this:
 *     ```
       function test_shortcode(){
       echo '
       [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');
       ```
   
 * but the same error persists
 *  Thread Starter [ravock](https://wordpress.org/support/users/ravock/)
 * (@ravock)
 * [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question-2/#post-5535445)
 * UPDATE:
 *     ```
       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 the only thing that doesn’t work is the span style colors, can anyone help
   me just with that?

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

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

 * ![](https://s.w.org/plugins/geopattern-icon/simple-tooltips_cfcfcf.svg)
 * [Simple Tooltips](https://wordpress.org/plugins/simple-tooltips/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/simple-tooltips/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/simple-tooltips/)
 * [Active Topics](https://wordpress.org/support/plugin/simple-tooltips/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/simple-tooltips/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/simple-tooltips/reviews/)

 * 2 replies
 * 1 participant
 * Last reply from: [ravock](https://wordpress.org/support/users/ravock/)
 * Last activity: [11 years, 5 months ago](https://wordpress.org/support/topic/do_shortcode-question-2/#post-5535445)
 * Status: not resolved