I went according to a support topic to build an author frontend filter with select option
i added a Post author filter in query filter with Author's is set by the URL parameter:
author-filter.
Than i added in the filter editor :
<select name="author-filter" class="wpcf-form-select form-select select">[list-of-authors]</select>
and in the theme php i added:
add_shortcode("list-of-authors", "list_of_authors");
function list_of_authors() {
$out = '<option value="">All</option>';
$users = get_users();
foreach ($users as $user) {
$selection = (isset($_GET['author-filter']) ? $_GET['author-filter']: '');
$out .= '<option ' . selected($user->ID, $selection, false) . ' value="' . $user->ID . '">' . $user->display_name . '</a>';
}
return $out;
}
it works perfect with no ajax automatic update (only submit button).
is there anyway to make the author filter parameter in the url to be updated with this php select code with ajax?
also is there any planning to next version of views (when?) to add author and date in the parametric serach options?
It is a so needed customization that it is strange that for years people wrote asking for it and it is still not made.
Thanks a lot
Thanks
Dear meirk,
You will need to setup the CSS class name of "author-filter" dropdown as "js-wpv-filter-trigger", for example, you can modify the HTML codes in "Filter editor" from:
<select name="author-filter" class="wpcf-form-select form-select select">[list-of-authors]</select>
To:
<select name="author-filter" class="js-wpv-filter-trigger">[list-of-authors]</select>
And test again.
bsd
works great!!!!! thanks
is there anyway to make it work also to allow in this customized field the option to hide or disable irrelevant options for inputs as in custom search settings appears?
Why this option doens't appear in the "new filter" native options of types?
thanks
waiting for last questions
thanks
There isn't such a built-in feature within Views plugin, if you agree, we can take it as a feature request, our developers will evaluate it.
bsd
how much it would cost to add this custom feature (total author and date native wp post integrated with frontend user filter at toolset)?
thanks
There isn't any more cost in a feature request, but it needs our developers's evaluation:
Check the possibility and put it into our to-do list, then it will be applied in the future version of Views plugin.