Array as a shortcode attribute.

Hi !

I’m actually trying to give an array as an attribute to my shortcode.

Here is my shortcode :

<?php echo do_shortcode('[map id="map" address='.$tab_addresses.']') ?>

Where $tab_addresses is an array of addresses.

Here is the function of my shortcode :

function outletfct($attr) {
// default atts
$attr = shortcode_atts(array(
'id' => 'map',
'address' => array(''),
), $attr);
var_dump($attr['address']);
}

The var_dump return :

string(5) "Array"

I don’t want a string but an array…

Could you help me ?

Thanks

  • noomiastudio
    • Design Lord, Child of Thor

    It’s a multidimentional array. My array contains some arrays… For example :

    array(2) { [0]=> array(7) { [0]=> string(7) "Sports7" [1]=> float(50.3939954) [2]=> float(4.4571447) [3]=> string(52) "125 Avenue de Philippeville 6001 MARCINELLE Belgique" [4]=> string(4) "Test" [5]=> string(19) "0032 (0)71 47 91 01" [6]=> string(19) "0032 (0)71 43 91 36" } [1]=> array(7) { [0]=> string(17) "Tennisland Rebecq" [1]=> string(33) "rue Zaman 87 1430 Rebecq Belgique" [2]=> string(33) "rue Zaman 87 1430 Rebecq Belgique" [3]=> string(33) "rue Zaman 87 1430 Rebecq Belgique" [4]=> string(0) "" [5]=> string(18) "+32 (0)67 67.02.67" [6]=> string(18) "+32 (0)67 67.03.49" } }

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.