Okay
  Print

How to use Reactive pro hooks?

NB: Check the hooks.md file inside the plugin files to know about hooks and where they are available.

For example if you want to modify the image size, you can try it like below

function reactiveProCustomGridData ($data){
    
 $data['300image'] = get_your_modify_image_data_here();
return $data;    
}
    
add_filter(
    'reactivepro_get_grid_all_data', // hook class 
    'reactiveProCustomGridData', // wordpress function  
    10,
    2
);

Now in the grid template code you can use it like below inside the post loop

{{post.300image}}


I want to use a hook for changing the order of categories in my search block.
do not want to order by name, but custom array order that I specify in a hook.
which hook should I use?

=> ok I solved it, partially. If I order by slug, then I can rename the slugs with "01-*****", 02-*****" and it won't affect the name of the filters on the frontend, but it will change the order.

function reactivecatorder ($data){
    
 $data = wp_list_sort($data, "slug");
return $data;    
}
    
add_filter(
    'reactivepro_get_all_terms', // hook class 
    'reactivecatorder', // wordpress function  
    10,
    2
);

and another method, by custom order

function reactivecatorder  ($data){
    
// put custom order of term ids below
$order = array(37, 38, 39, 40, 47, 90, 71, 72, 73, 74, 75, 76, 77, 78, 87, 88, 89);
$array = $data;
usort($array, function ($a, $b) use ($order) {
    $pos_a = array_search($a['term_id'], $order);
    $pos_b = array_search($b['term_id'], $order);
    return $pos_a - $pos_b;
});
$data = $array;
return $data;    
}
    
add_filter(
    'reactivepro_get_all_terms', // hook class 
    'reactivecatorder', // wordpress function  
    10,
    2
);