Skip Navigation

[Resolved] Author frontend filtering with views and ajax

This support ticket is created 7 years, 7 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Hong_Kong (GMT+08:00)

This topic contains 7 replies, has 2 voices.

Last updated by meirk 7 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#492813

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

#492905

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.

#493073

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

#493427

waiting for last questions
thanks

#493468

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.

#494402

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

#494883

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.

#495244

thanks

This ticket is now closed. If you're a Toolset client and need related help, please open a new support ticket.