自定义短代码<pre> and <code> before the returned string

时间:2016-04-15 10:58:56

标签: shortcode

so I have a question regarding custom shortcodes! I created a shortcode for a href as the following:

function makeUrl( $atts , $content = null ) {
extract(shortcode_atts(
    array(
        'href' => '#',
    ), $atts ));
return '<a href="'.$href.'">'.$content.'</a>';
}

add_shortcode('url', 'makeUrl');

So basic usage is at [url href="http://www.google.com"]Google[/url] however the problem is when it comes to formatting, when I checked the generated code is enclosed in pre and code blocks like the following:

<pre class="language-php">
    <code class="language-php">
        <a href="http://www.google.com">Google</a>
    </code>
</pre>

What am I doing wrong? Thanks.

0 个答案:

没有答案