• Resolved Jay

    (@the_circle_pit)


    Hello,

    I want to use the shortcode_exists() function to check if the shortcode [slider id=”1″] exists. I have a feeling the space is messing things up, but am not sure.

    Current Code

    if (shortcode_exists( 'slider id="1"' )) {
        echo do_shortcode( '[slider id="1"]' );
    }

    I have also tried…

    shortcode_exists( '[slider id="1"]' )

    Thank you for any help.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The shortcode_exists() function only takes the shortcode name, no other attributes or characters. You’d only want to use ‘slider’ for your site. In your case you’d use it like this:

    if (shortcode_exists( 'slider' )) {
        echo do_shortcode( '[slider id="1"]' );
    }
    Thread Starter Jay

    (@the_circle_pit)

    You the man catacaustic.

    Thank you.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘shortcode / shortcode_exists help’ is closed to new replies.