albertoG-9
In den letzten 30 Tagen erstellte Support-Threads: 0
Lieblings-Forenthemen
This user has no favorite topics.
Forum Topics Created
| Status | Thema | Supporter | Stimmen | Artikel | Aktualität |
|---|---|---|---|---|---|
|
Map loads empty and marker button not focusing
1
2
Gestartet von: albertoG-9 in: Toolset Professional Support |
|
1 | 16 | vor 1 month, 2 weeks | |
|
Change Operator for view where category set by the page where this view is shown
Gestartet von: albertoG-9 in: Toolset Professional Support |
|
1 | 7 | vor 4 months, 2 weeks | |
|
Filter view query with taxonomy and allow users to filter through its terms only
Gestartet von: albertoG-9
in: Toolset Professional Support
Problem: The customer wants to display posts on a page filtered by the taxonomy "Mitglieder" and allow users to filter the list by the terms of this taxonomy. However, setting the search filters resulted in the page querying all posts when no filters were applied by the user, rather than pre-filtering by the "Mitglieder" taxonomy. Solution: We added a custom code snippet to the site's functions.php file using the wpv_filter_query filter. This code pre-filters the query to include only posts that have any term from the "Mitglieder" taxonomy assigned. This initial filtering ensures that the user can use the front-end filter without losing the pre-filtered query. The code targets only the specific view in question, ensuring that posts without any terms assigned from the "Mitglieder" taxonomy are excluded from the results:
add_filter( 'wpv_filter_query', 'filter_mitglieder_taxonomy', 101, 3 );
function filter_mitglieder_taxonomy($query, $setting, $views_ID)
{
if($views_ID == 1082) // your view ID
{
$query['tax_query'][] = array(
'taxonomy' => 'mitglieder', // taxonomy name
'field' => 'slug',
'operator' => 'EXISTS' // Check if any term from the taxonomy is assigned
);
$query['tax_query']['relation'] = 'AND';
}
return $query;
}
|
|
2 | 6 | vor 1 year, 9 months |