Plugin Author
YMC
(@wssoffice21)
Hello!
To display the number of posts in the filter, you can override the output using this hook, for example:
function ymc_posts_selected($layouts, $founded_post) {
$query = new WP_Query( [
'post_type' => 'post',
'posts_per_page' => -1
] );
$layouts="Example text " . $founded_post .' from ' . $query->found_posts;
return $layouts;
}
add_filter('ymc_posts_selected_72_1', 'ymc_posts_selected', 10, 2);Inside the hook, you create your own custom WP_Query and get the number of all posts according to the specified parameters and then display them.
Or this hook:
add_action( 'ymc_after_filter_layout_72_1', 'my_after_filter_function' );
function my_after_filter_function () {
$query = new WP_Query( [
'post_type' => 'post',
'posts_per_page' => -1
] );
echo 'Total posts: ' . $query->found_posts;
}Also, for dynamically changing parameters you can also use a JavaScript hook, for example:
wp.hooks.addAction('ymc_after_loaded_data_72_1', 'smartfilter', function(target, res){
console.log('Complete loaded data ' + target + ' ' + res.found);
});This hook is triggered when the filter receives all posts and inserts them into the grid. In any case, using different hooks you can display and insert data in the right place. We hope this helps you.
Just don’t forget to change the filter ID and its number on the page (ex: 72_1) – change it to yours
For more detailed information please read the filter documentation https://github.com/YMC-22/smart-filter
Update the plugin
- This reply was modified 2 hours, 5 minutes ago by YMC.
- This reply was modified 1 hour, 59 minutes ago by YMC.
Plugin Author
YMC
(@wssoffice21)
If you have any questions, please contact us. Good luck!
