Tell us what you are trying to do?
I have a taxonomy view that embeds a Woocommerce products view filtered by the parent taxonomy term.
This taxonomy is a product attribute and terms are Unix timestamps.
I would like to show only the terms greater than today.
Is there any documentation that you are following?
Is there a similar example that we can see?
What is the link to your site?
versteckter Link
Minesh
Supporter
Sprachen:
Englisch (English )
Zeitzone:
Asia/Kolkata (GMT+05:30)
Hello. Thank you for contacting the Toolset support.
I've to review you structure and where on what page you have added the view and what view you want to filter?
Can you please share all those require information that should help me to understand your issue and once I review your setup I will be able to guide you in the right direction.
*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site. Preferably to a test site where the problem has been replicated if possible in order to be of better help and check if some configurations might need to be changed.
I have set the next reply to private which means only you and I have access to it.
This should be done with custom code and wpv_filter_taxonomy_query filter but I don't know how.
Hi,
So any news about my request ?
Cheers.
Hi,
Website is broken, I get :
Array
(
[hide_empty] => 1
[hierarchical] => 1
[pad_counts] => 1
[orderby] => name
[order] => ASC
[include] => Array
(
[132] => 132
[127] => 127
[125] => 125
[134] => 134
)
)
Plese try to avoid breaking things, I am actively working on this site.
Minesh
Supporter
Sprachen:
Englisch (English )
Zeitzone:
Asia/Kolkata (GMT+05:30)
Actually I was testing the shortcode I build.
To filter the taxonomy view, you will require to use the view's filter hook: wpv_filter_taxonomy_query
=> https://toolset.com/documentation/programmer-reference/views-filters/#wpv_filter_taxonomy_query
To get only the term IDs of future date, you will require to write some custom code for example:
$all_terms = get_terms( 'pa_jours-affichage', array(
'hide_empty' => false,) );
$include = array();
foreach($all_terms as $k=>$v):
if($v->name > time()){
$include[$v->term_id] = $v->term_id;
}
endforeach;
So you should hook in the found term IDs in $include variable those are the terms greater than the current time.
Hi,
Thanks a lot for your precious help.
Finally works wi the following code :
add_filter( 'wpv_filter_taxonomy_query', 'exclude_specific_terms_func', 99, 3 );
function exclude_specific_terms_func( $tax_query_settings, $view_settings, $view_id ) {
if ( 49713 == $view_id || 49756 == $view_id ) {
$all_terms = get_terms( 'pa_jours-affichage', array('hide_empty' => false,) );
$exclude = array();
$current_time = current_time( 'timestamp');
$tomorrow = strtotime('tomorrow');
foreach($all_terms as $k=>$v):
if( intval($v->name) < $tomorrow ){
$exclude[$v->term_id] = $v->term_id;
}
endforeach;
$tax_query_settings['exclude'] = $exclude;
}
return $tax_query_settings;
}