WordPress.org

Ready to get started?Download WordPress

Forums

add_shortcode question, arrays (1 post)

  1. consumedesign
    Member
    Posted 3 years ago #

    I am trying to make it as simple for a client to add a shortcode to their text area in the admin and it will produce a Paypal button with options (didn't see any plugins that would help and are simple). I have

    function paypal_func( $atts ) {
    	echo '<pre>';print_r($atts);echo '</pre>';
    }
    add_shortcode( 'pp', 'paypal_func' );

    and

    [pp button="XXXXBUTTONCODEXXXX" option="Sizes: Small, Medium, Large, Extra Large, XXL" option="Type: Male, Female"]

    the result is:

    Array
    (
        [button] => XXXXBUTTONCODEXXXX
        [option] => Type: Male, Female
    )

    I was hoping that it would result in the option as an array instead of overriding it with the 2nd one. Is there anyway to pull the data and have it result in an array so it would be:

    Array
    (
        [button] => XXXXBUTTONCODEXXXX
        [option] => Array
            (
                [0] => Sizes: Small, Medium, Large, Extra Large, XXL
                [1] => Type: Male, Female
            )
    
    )

    I doubt there is but was hopeful maybe someone came across this problem before.
    thanks.

Topic Closed

This topic has been closed to new replies.

About this Topic