i have the following shortcode
function cta_button($atts , $content = null) {
extract(shortcode_atts(array(
'cta_url' => '',
'cta_buttentext' => '',
), $atts));
return '<div class="ctabox"><div class="ctacontent">' . $content . '</div><a href="http://'. $cta_url . '" class="ctabutton">' . $cta_buttentext . '</a><br style="clear: both;"></div>';
}
add_shortcode( 'cta', 'cta_button' );
If I use the shortcode in the editor with
[cta cta_url=http://www.domain.com cta_buttentext=This is just a test]Text[/cta]
the text “This is just a test” is to short/wrong. On the front end, it shows only “This”. The rest of the string is “emtpy”. “is just a test” is cut.
Can you help me?
And sory for my english 🙁
bg
janw
You should put quotes around the attribute value, since spaces are what WordPress uses when it parses for new attributes: