Append jquery script for each [partners] shortcode with specified values

The issue is that each time a shortcode is processed, you’re overwriting the previous value with the new value, so you’ll always only get the data for the last instance of your shortcode.

The simplest way to work within what you’ve already got is to put the data into an array.

global $pslider;
// generate a unique identifier
$unique_id = uniqid();
// save your data under that unique key
$pslider[$unique_id] = 'some data';
// use that unique ID in your markup
$output="<div id="partners-slider-" . $unique_id . '">';


// then later in your footer funtion,
// loop over each instance and output your js
global $pslider;
foreach( $pslider as $id => $value ):
    echo 'unique ID: ' . $id;
    echo 'value: ' . $value;
endforeach;

Personally, I avoid global vars like the plague. I would wrap this whole thing in a class and use a class var to store your data.