|
URL parameter not working as expected
Started by: morktron
in: Toolset Professional Support
Quick solution available
Problem: I have a taxonomy View that responds to a URL parameter, and should filter only terms that begin with that letter. In the past, this View was working correctly but it has begun to show inaccurate results.
Solution: Replace your taxonomy query filter code with the updated version below.
add_filter( 'wpv_filter_taxonomy_query', 'prefix_modify_tax_query', 10, 3 );
function prefix_modify_tax_query( $tax_query_settings, $view_settings, $view_id ) {
if($view_id != 62 && isset($_GET['wpvalphabet']) && $_GET['wpvalphabet'] != '' ) {
$tax_query_settings['name__like'] = $_GET['wpvalphabet'];
}
return $tax_query_settings;
}
function old_style_name_like_wpse_123298($clauses) {
remove_filter('term_clauses','old_style_name_like_wpse_123298');
$splits = explode('}', $clauses['where']);
$joins = array();
if(sizeof($splits) == 1) {
return $clauses;
}
foreach($splits as $split) {
$joins[] = substr($split, 0, strpos($split, '{'));
}
$clauses['where'] = join($joins, '') . (sizeof($joins) > 1 ? "%'" : '');
return $clauses;
}
add_filter('terms_clauses','old_style_name_like_wpse_123298');
Relevant Documentation: https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_taxonomy_query
https://developer.wordpress.org/reference/hooks/terms_clauses/
|
|
2 |
5 |
7 years ago
morktron
|
|
Clicking next the page does not go to the top. Read more link disappears.
Started by: davidM-17
in: Toolset Professional Support
Quick solution available
Problem:
When clicking the next link at the bottom of the page I expected to go to the top of the next page.
Solution:
There isn't such a built-in feature within Views plugin, but you can try with some custom JS codes, for example:
1) Edit your view, find the "next" and "Previous" link shortcode, add attribute class="scroll-to-top" in it, for example:
[wpv-pager-prev-page force="true" class="scroll-to-top"][wpml-string context="wpv-views"]Previous[/wpml-string][/wpv-pager-prev-page]
[wpv-pager-next-page force="true" class="scroll-to-top"][wpml-string context="wpv-views"]Next[/wpml-string][/wpv-pager-next-page]
2) in section "Filter Editor", click "JS editor", add below JS codes:
function scroll_to_top(){
jQuery("a.scroll-to-top").click(function(event) {
jQuery("html, body").animate({ scrollTop: 0 }, "slow"); // jump to the page top
event.preventDefault()
});
}
jQuery( document ).on('js_event_wpv_pagination_completed', function( event, data ) { // when ajax pagination is completed
scroll_to_top();
});
scroll_to_top();
And test again.
Relevant Documentation:
|
|
2 |
3 |
7 years, 2 months ago
davidM-17
|
|
Content disapearing after pagination
Started by: sebastienV
in: Toolset Professional Support
Quick solution available
Problem: I have a nested View setup where pagination occurs on the outermost View. When I navigate back and forth through the paginated results and return to the first page, some results are no longer found on my inner Views.
Solution: First Month View - uncheck "Don't include current page in query result"
Last Month View - uncheck "Don't include current page in query result"
Loop item in Home Agenda Events - add cached="off" to both First and Last Month View shortcodes.
|
|
2 |
3 |
7 years, 3 months ago
sebastienV
|