• Hi.

    I am using Joe Tan’s flickr plugin which now supports shortcodes and the attribute parsing doesn’t seem to work on one of my testing servers.

    The shortcode is like this:
    [flickr album="72157604931449442" num="14"]

    And the beginning of function that handles it:

    function getShortCodeHTML($attribs=false, $content=false) {
        	global $post;
        	extract(shortcode_atts(array(
        		'album' => null,
        		'tag'     => null,
        		'num'     => 5,
        		'size'    => 'Square',
        		'scale'   => 1,
        	), $attribs)); echo $album.' '.$num;

    For debugging, I’ve added an echo of the album and num attribute right after the attribute extraction.

    The function does it’s job and works well on my local server (which is 2.5.0 still).
    72157604931449442 14

    On the remote server (2.5.1), it ignores the space that separates them and goes like this:
    ”72157604931449442” num=”14” 5

    So it takes everything it gets, including the quotes, after declaring the album attribute.

    How can I fix this?

Viewing 4 replies - 1 through 4 (of 4 total)
  • Thread Starter GreenDude

    (@greendude)

    Anyone? ??

    Try the page below for help with your plugin:

    https://flickr.com/groups/tantannoodles/discuss/

    Thread Starter GreenDude

    (@greendude)

    Yes, I know it well, but I’ve separated the problem form the plugin. The function is just like the codex model.

    I took a look at the code, and it looks like what’s happening is that there’s some sort of non-standard whitespace character getting inserted between the first and second parameter.

    This causes the WP shortcode attribute parsing routine to mash together the attributes…

    eg

    [flickr album=123456 num=10]

    should give this attribs:

    $album = 123456
    $num = 10

    But because of the non-standard whitespace between “123456” and “num” this happens:

    $album = “123456 num=10”

    Perhaps this is due to the fact that GreenDude’s blog uses international characters? Or he somehow entered in a “space” that’s slightly different….

    This is on a WP 2.5.1 installation.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Shortcode messes up attributes’ is closed to new replies.