Support » Plugin: Shortcoder — Create Shortcodes for Anything » Pass parameters to shortcoder

  • I had created a shortcode in functions.php, but would like to use shortcoder for it. The code is below. The question is, how can I pass the $atts and $tag attributes to shortcoder? Typical usage is [wbpsb title=”first%20degree%20rage”].

    function wbpsb_shortcode($atts = [], $content = null, $tag = '')
    {
        // normalize attribute keys, lowercase
        $atts = array_change_key_case((array)$atts, CASE_LOWER);
     
        // override default attributes with user attributes
        $wbpsb_atts = shortcode_atts([
                                         'title' => 'WordPress.org',
                                     ], $atts, $tag);
     
    	// load sales buttons for this title. The title is all lowercase using every word in the proper title with %20 in place of spaces. Here are some example formats for the title:
    	//  lockout
    	//  paper%20wings
    	include "https://wildbluepress.com/wp-content/themes/magazine-pro/wbp-maincontentsalesbuttons.php?title=".$wbpsb_atts['title'];
     
        // return output
        return $o;
    }
     
    function wbpsb_shortcodes_init()
    {
        add_shortcode('wbpsb', 'wbpsb_shortcode');
    }
     
    add_action('init', 'wbpsb_shortcodes_init');

    The page I need help with: [log in to see the link]

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • You must be logged in to reply to this topic.