• Resolved maroxis

    (@maroxis)


    Test shortcode functionality is not working with more than 1 parameter. It outputs either 0 or nothing. Copying shortcode and using it normally on site, shows correct value.

Viewing 1 replies (of 1 total)
  • Plugin Support Disu

    (@disu)

    Hi @maroxis . Can you give a more exhaustive example, telling us which shortcodes do you use?

    However I created a simple test shortcode that write a text with a custom color and size, that are two shortcode parameters. When I test it with Shortcodes Finder it works correctly.

    You can try adding this code to functions.php

    function colored_text_shortcode($atts, $content = null) {
    $atts = shortcode_atts(
    array( 'color' => 'black', 'size' => '16px'),
    $atts,
    'colored_text'
    );
    $content = do_shortcode($content);
    return '<span style="color: ' . esc_attr($atts['color']) . '; font-size: ' . esc_attr($atts['size']) . ';"
    >$content . '</span>';
    }
    add_shortcode('colored_text', 'colored_text_shortcode');

    If you try the colored_text shortcode in the plugin, using as parameters: color=red size=32px
    and as text: Simple text
    you will see a colored and big text. So it is working with two parameters.

    Consider that, depends on how some shortcodes are written, some of them cannot work in a test environment, like the page provided by the plugin.

Viewing 1 replies (of 1 total)

The topic ‘Test shortcode not working with multiple parameters’ is closed to new replies.