Data From WordPress Filter

Estimated reading: 1 minute 248 views

This feature gives you the option of getting the dynamic data from wordpress add_filter ‘graphina_divi_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 (like line, area, etc.)
//$settings -> divi setting array
//$widgetId -> Id of divi module ( each module have unique id)

add_filter(‘graphina_divi_extra_data_option’,function($data, $type, $settings,$widgetId){
          if($type == ‘pie’ || $type == ‘donut’ ){
                 return [
                        ‘series’ => [52, 62 ,48,52 ],
                        ‘category’ =>  [ “Jan”, “Feb”, “Mar”,  “Apr” ],
                        ‘total’=>542
                   ];
            }
            if($type == ‘area’ || $type == ‘column’ || $type == ‘bar’ || $type == ‘line’ || $type == ‘radar’ ){
                    return [ ‘series’ => [
                           [
                            ‘name’ => ‘element’,
                            ‘data’ => [ 52,58,85,14]
                           ]
                     ],
                     ‘category’ => [ “Jan”,  “Feb”,  “Mar”, “Apr”]
                     ];
              }
  }, $priority, $accepted_args);

How to get data from wordpress filter

Leave a Comment

Share this Doc

Data From WordPress Filter

Or copy link

CONTENTS