Skip Navigation

[Resolved] sort rfg

This support ticket is created 3 years, 4 months ago. 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.

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)

This topic contains 25 replies, has 2 voices.

Last updated by alexd-6 3 years, 4 months ago.

Assisted by: Minesh.

Author
Posts
#2112023
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..

it is in Toolset > Einstellungen > Custom Code - > custom Function for view id.

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);
#2112119

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Do you mean that you want to sort the date value of date field "datum-und-uhrzeit" in ASC order?

#2112135

Hi Minesh,

i would sort the "Slide-order" about the next date.

you know what i mean?

thx - alex

#2112143

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

But slide order is actually a date field belongs to Repeating Field Group (RFG) - right?

You want to sort the slide based on the date field "datum-und-uhrzeit" value in ASC order?

#2112151

Hi, yes thats right: i want to sort the slide based on the date field "datum-und-uhrzeit" value in ASC order.

thx - alex

#2112205

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

There is no easy way as the help you are asking is purely needs custom code, I already help beyond the scope of our support policy as such custom programming is beyond our scope.

The thing is that, you want to display slides that should be ordered by date custom field and that date custom field is part of repeating field group.

Basically, you can query the content inside the view's loop that belongs to the post type you set your view to query. But in your case you want to sore post type "Veranstaltungen" posts based on the custom date field that is part of repeating field group and for that you have added another view as follows:
=> hidden link

You can not sort View A that is set to query post type X based on another view B's (in your case its repeating field group) custom date field.

If you want to sort the results of View A, the date custom field should be part of post type "Veranstaltungen".

#2112213

hey,
how can i give you an "order" to do this for my function? - Can you make me an offer?

thx in advance - alex

#2112217

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

What you mean by "order"? what order you suppose to give me?

Please share and let me review it and see if I can offer you any help.

#2112223

Hey,

i want to have an coder like you, to make the function do what i want. I will pay for.

You know what i mean?

thx - alex

#2112241

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately, as shared that is beyond the scope of our support policy.

If you want to learn and want such custom programming for your project, you are welcome to contact any of the certified partners from the following link:
- https://toolset.com/contractors/

#2112325

hi Minesh, its hard to find an contractor. Can you give me a hint for one?

thx - alex

#2112947

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Unfortunately - I do not have any suggestion but you can work with anyone you like as all those are certified Toolset contractors.

#2113007

hey,

can i take the relevant Timestamp to Array with ID and sort it then by Timestamp?

here we take the ID to array, - can we do that with Id and timestamp?

$partone = types_render_field('datum-und-uhrzeit', array('post_id' => $fieldvalue->ID,'output'=>'raw'));

thx - alex

#2113009

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It's not possible as you are displaying the date value using another view (the following one):
- hidden link

#2113019

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

If you can tell me in what order you want to display the dates I can review and tell you if it I can help you in any way.