woof_redraw_elements_after_ajax
Allows to add any messages while user make filtration in AJAX mode.
Example:
add_filter('woof_redraw_elements_after_ajax', function($fields, $query) { ob_start(); if (isset($query->query['tax_query']) AND $query->query['tax_query']) { $html = "<h1 class='entry-title'>Looks like you like the color:"; foreach ($query->query['tax_query'] as $item) { if (isset($item['taxonomy']) AND $item['taxonomy'] = 'pa_color') { $term = get_term_by('slug', $item['terms'][0], 'pa_color'); if (is_object($term)) { $html .= $term->name; } } } echo $html, "!</h1>"; $fields['.entry-title'] = ob_get_contents(); } ob_end_clean(); return $fields; }, 999, 2);
In example above user gets message if select any color in the filter. Demo see here – select any color. By this logic you can any commercial suggestions for the user while they use filtration.
Be attentive with:
- $fields[‘.entry-title‘] = ob_get_contents(); – by red is css class of the container where message should appear
- $html = “<h1 class=’entry-title’>Looks like you like the color:”; … echo $html, “!</h1>”; – here is the message itself, and of course you can use using PHP switch display different messages for different content of the search requests
Troubles? Ask for Support!