• Resolved mYrAn

    (@myran)


    Hello.

    I’m building some shortcodes for my site, and right now I’ve come across a rather annoying problem. This is my code:

    function short_design_tab($atts, $content = null) {
        extract( shortcode_atts( array(
            'titel' => 'default',
    	'bild' => '',
        ), $atts ) );
    
        return '
    	<div class="design-tab">
           	<h3>'. $titel .'</h3>
            <div class="tab-spacer"></div>
            <img src="'. bloginfo('template_url') . "/" . $bild .'" alt="" class="big-image" />
    		' . do_shortcode($content) . '
    	</div>';
    }

    The problem is that it doesn’t echo out the template url where I ask it to, but as the first element under the parent element, as regular text. So it appears on the page, in text form. How do I fix this?
    Thanks in advance!

Viewing 1 replies (of 1 total)
  • Thread Starter mYrAn

    (@myran)

    Nevermind this.. Why is it that when you think you’ve tried it all and ask for help you often solve it right away by yourself? Anyways, for people finding this thread in the future, use this:

    function short_design_tab($atts, $content = null) {
        extract( shortcode_atts( array(
            'titel' => 'default',
    	'bild' => '',
        ), $atts ) );
    
        return '
    	<div class="design-tab">
           	<h3>'. $titel .'</h3>
            <div class="tab-spacer"></div>
            <img src="' . get_template_directory_uri() . "/images/" . $bild .'" alt="" class="big-image" />
    		' . do_shortcode($content) . '
    	</div>';
    }
Viewing 1 replies (of 1 total)

The topic ‘bloginfo – template_dir in a shortcode?’ is closed to new replies.