• 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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter ravock

    (@ravock)

    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

    (@ravock)

    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.