Hi Minesh,
i checked it and function is working! - But if the last Slide with aktiv, dont loop to first? How can i release this?
Look into my View hidden link - i do two conditions in it - it works.
But if i do this around the content-template: it dont loop to first.
[wpv-conditional if="( '[datetime postidmy='[wpv-post-id]']' eq 'aktiv') AND ( $(wpcf-highlight) eq '1' )"]
right its aktiv
[/wpv-conditional]
[wpv-conditional if="( '[datetime postidmy='[wpv-post-id]']' ne 'aktiv')"]
wrong its not aktiv
[/wpv-conditional]
best regards and nice Sunday. - alex
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
I've removed the conditional statement as it will not be useful.
I've added the following filter to "Custom Code" section offered by Tooslet:
function func_adjust_slider_posts_query( $query_args ,$view_settings, $view_id ) {
global $post;
if ( $view_id == 10897 ) {
$args = array(
'post_type' => 'veranstaltung',
'meta_query' => array(
array(
'key' => 'wpcf-highlight',
'value' => '1',
)));
$postslist = get_posts( $args );
$temp = array();
$today = date("j. F Y H:i");
$todaytimestamp = strtotime($today);
foreach($postslist as $k=>$v):
$fieldvalues = toolset_get_related_posts( $v->ID, "termine-veranst", array( 'query_by_role' => 'parent', 'return' => 'post_object'));
foreach ($fieldvalues as $fieldvalue) {
$partone = types_render_field('datum-und-uhrzeit', array('post_id' => $fieldvalue->ID,'output'=>'raw'));
if ($partone > $todaytimestamp) {
$temp[] = $v->ID;
break;
}
}
endforeach;
$query_args['post__in'] = (!empty($temp))?$temp:0;
}
return $query_args;
}
add_filter( 'wpv_filter_query', 'func_adjust_slider_posts_query', 10, 3);
The above filter code will help us to find first all the posts with highlight equal to 1 and then we loop through every found post to find its related repeating field group posts and we will check if the date is greater than today's date then we will display the post otherwise we will skip the post.
Can you please confirm it works as expected now. I can see it also loop back to first post in slider.
Hi Minesh,
big thx! - But tell me: my Way can work too, logical, or? Why it dosn't work?
And: can i put this code twice, of course if i rename functionname, in an other view as well?
again: big thx!
best regards - alex
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
But tell me: my Way can work too, logical, or? Why it dosn't work?
==>
It was logical but your solution will not work in this case as we will require to pre-filter the view results before it gets displayed. With using your solution it was hiding the loop item content using condition but it will not remove the posts Completely the result set that is why we will require to pre-filter the views results.
And: can i put this code twice, of course if i rename functionname, in an other view as well?
==>
Yes - you can.
Hey Minesh,
you are the very best support-god!
My issue is resolved now. Thank you very much!
warmly - alex
hi,
one question about it: can i sort the post to show about this date? i have too..
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
May I kindly ask you to open a new ticket for every new question you may have. This will help other users searching on the forum as well as help us to write correct problem resolution summery for the original issue submitted. This ticket already become a story of three long pages.
Thank you for understanding.
@minesh - oh sorry - can you have a look here: https://toolset.com/forums/topic/sort-rfg/
thx - alex
Minesh
Supporter
Languages:
English (English )
Timezone:
Asia/Kolkata (GMT+05:30)
You are welcome to mark resolve this ticket.
My issue is resolved now. Thank you a lot!