Closed webangon closed 7 years ago
Look at your coed snippet:
if (fw_akg('display/display_type', $atts) === 'individual') {
$options = fw_akg('display/individual', $atts);
$icon= $instance['individual_id'];
// var_dump($icon); -- Nothing output
}
First you get the individual
value in $options
variable:
$options = fw_akg('display/individual', $atts);
Then instead of taking the icon from $options
, you take it from $instance
:
$icon= $instance['individual_id'];
But it should be:
$icon= $options['individual_id'];
But you can do it even better:
$icon = (fw_akg('display/display_type', $atts) === 'individual')
? fw_akg('display/individual/individual_id', $atts)
: null //Or whatever you need instead
Thank you . But $icon= $options['individual_id'];
works when getting values from shortcode but this is not shortcode, this is in widget . And var_dump of $instance['display']
as follows
array(3) { ["display_type"]=> string(8) "taxonomy" ["individual"]=> array(1) { ["individual_id"]=> array(0) { } } ["taxonomy"]=> array(1) { ["taxonomy_id"]=> array(2) { [0]=> string(1) "1" [1]=> string(1) "5" } } }
But how you save the options, this doesn't have to do anything with fw_akg
?
I just have checked that fw_akg
works fine . Probably I am missing value of $atts
in this if(fw_akg('display/display_type', $atts) === 'individual')
. How does $atts
work in widget?
We do not have any functionality of option type for widgets, so you control all data flow, you render the options, you save them, you defined the $atts
value, so you should know what values it contains.
I am using multipicker settings in widget area.
So to get these vaules.
I think fw_akg is not for widget rather its for shortcode .
If I have widget with this settings
I can get these
Is really fw_akg owon't work for widget?