Support » How-To and Troubleshooting » [Resolved] Bug short codes add double quotes at the end

[Resolved] Bug short codes add double quotes at the end

  • Hi all please help! This is driving me nuts!

    I have a shortcode that I’m trying to add to my theme:

    this is the shortcode:

    function one_half( $atts, $content = null ) {
    	return "<div class='eight columns'>" . $content . "</div>";
    add_shortcode('one_half', 'one_half');

    This is what it outputs:

    <div class="eight columns">Half columns</div>&nbsp;<div class="eight columns">Half Second columns</div>

    Not sure if you can see it here but when I look up my source, I see this exactly:

    <div class="eight columns">Half columns</div>" "<div class="eight columns">Half Second columns</div>

    and the "" make it break. Is there anything I’m missing? Please help!


    P.S. I have already tried to put the following php code to remove the p tag which helped but didn’t remove the "":

    remove_filter ('the_content', 'wpautop');

Viewing 4 replies - 1 through 4 (of 4 total)
  • esmi


    Forum Moderator


    function one_half( $atts, $content = null ) {
    	return '<div class="eight columns">' . $content . '</div>';
    add_shortcode('one_half', 'one_half');

    Thanks esmi, tried that before posting this and still the double quotes show up, but what I realized is that they show up because of the space I would put on there would create a &nbsp; I removed any spaces between the shortcodes and added a line break and the problem went away. That was so weird!

    same issue here as well.
    If you have a shortcode which accepts parameters as :

    [tooltip tip=”Some tooltipc ontent here “]Tooltip Anchor[/tooltip]

    now if I call this tooltip manually at some place using:

    $string='[tooltip tip=”Some tooltip content here “]Tooltip Anchor[/tooltip]’;
    echo do_shortcode($string);

    You’ll see that top ends at “Some” , breaks at space…
    Weird, I guess that is a bug.

    Update: I found that my issue isn’t exactly the same as this one. As I was first storing the shortcode in the database postmeta and then outputting the shotcode. While saving in post meta the shortcodes double quotes & single quotes got converted in hex code which were not recognized by the do_shortcode on execution which resulted in this behaviour of shortcodes.

    ( v )

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Resolved] Bug short codes add double quotes at the end’ is closed to new replies.