Skip Navigation

[Resuelto] condition combine dont work

This support ticket is created hace 3 años, 4 meses. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Hoy no hay técnicos de soporte disponibles en el foro Juego de herramientas. Siéntase libre de enviar sus tiques y les daremos trámite tan pronto como estemos disponibles en línea. Gracias por su comprensión.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

Este tema contiene 39 respuestas, tiene 2 mensajes.

Última actualización por alexd-6 hace 3 años, 4 meses.

Asistido por: Minesh.

Autor
Mensajes
#2111371

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 enlace oculto - 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

#2111893

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: 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.

#2111905

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

#2111917

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: 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.

#2111925

Hey Minesh,

you are the very best support-god!

My issue is resolved now. Thank you very much!

warmly - alex

#2111993
Bildschirmfoto 2021-07-12 um 11.57.14.jpg

hi,

one question about it: can i sort the post to show about this date? i have too..

#2112005

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: 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.

#2112011

@minesh - oh sorry - can you have a look here: https://toolset.com/forums/topic/sort-rfg/

thx - alex

#2112021

Minesh
Supporter

Idiomas: Inglés (English )

Zona horaria: Asia/Kolkata (GMT+05:30)

You are welcome to mark resolve this ticket.

#2112041

My issue is resolved now. Thank you a lot!