I am looking for a way to use a shortcode attribute in the php display format so I can reuse a format script for several templates.
I have several duplicated custom field templates with keys that have incremental indexes on the end such as:
Say I have the following shortcode:
[cft template=1 format=1]
I also have entered a [cft] shortcode format using PHP in the Custom Field Template settings page.
In that format PHP I want to be able to access shortcode attributes like so:
$all_custom_fields = base_get_all_custom_fields(); // returns an array of all custom fields on the page;
$cft_template = ?; //some way to get shortcode template attribute which would be 1 in the above shortcode
echo '<div>' . $all_custom_fields['content-box-' . $cft_template] . '</div>';
Anyone know how I can do this? I've been struggling with it for a week now.