Toolset: Author frontend filtering with views and ajax
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;
<select name="author-filter" class="js-wpv-filter-trigger">[list-of-authors]</select>
Visto en: https://toolset.com/forums/topic/author-frontend-filtering-with-views-and-ajax/
Toolset: Author frontend filtering with views and ajax Leer más »