data from wordpress filter

Estimated reading: 1 minute 624 views
This feature gives you the option of getting the dynamic data from WordPress add_filter ‘graphina_extra_data_option’

add this graphina filter in any WordPress file, for example, activate theme -> functions.php file  

Example :

//$data -> sample data
//$type -> type of widget (line, area)
//$settings -> elementor setting array
//$widgetId -> Id of elementor widget ( each widget have a unique id)

add_filter(‘graphina_extra_data_option’,function($data, $type, $settings,$widgetId){
          if($type == ‘pie’ || $type == ‘donut’ || $type == ‘radial’ || $type == ‘polar’ ){
                 return [
                        ‘series’ => [52, 62,48,52 ],
                        ‘category’ =>  [ “Jan”, “Feb”, “Mar”,  “Apr” ],
                        ‘total’=>542
                   ];
            }
            if($type == ‘area’ || $type == ‘column’ || $type == ‘brush’ || $type == ‘mixed’ || $type == ‘line’ || $type == ‘radar’ || $type == ‘distrubuted_column’){
                    return [ ‘series’ => [
                           [
                            ‘name’ => ‘elem’,
                            ‘data’ => [ 52,58,585,14]
                           ]
                     ],
‘category’ => [ ‘Jan’, ‘Feb’, ‘Mar’, ‘Apr’ ]
                     ];
              }
             if($type === ‘data_table_lite’ || $type == ‘advance-datatable’){
                    return [
                        ‘body’ => [
                            [‘abc’ , ‘xyz’],
                            [‘rtl’ , ‘yzr’]
                        ],
                        ‘header’ => [‘firstname’,’lastname’]
                    ];
             }

            if($type == ‘counter’){
                   return [ [‘title’ => ‘filter’,
                       ‘speed’ => 1200,
                       ‘start’ => 0,
                       ‘end’ => 8025,
                       ‘multi’ => []
                   ]];
             }

  }, $priority, $accepted_args);


How to get data from wordpress filter

Leave a Comment

Share this Doc

data from wordpress filter

Or copy link

CONTENTS