WordPress shortcode with a switch


I am developing a plugin and have a shortcode where some info is added.
this is called by [info]
I would like to be able to add an ‘extended’ param as a switch so that i can have extended info if i set this
[info] would show short info and [info extended] would show extended with something like

   function info($atts){
            'extended' => '',
            ), $atts));
        echo 'info';
        if (isset($extended)){
            echo 'More info';
      return ob_get_clean();

but can not find how to do this. I only find options where i must add value to the param and check this like [info extended=”full”] and then check the value of the param.
Anyone got some pointers?

Ygdrazil 4 months 0 Answers 22 views 0

Leave an answer