Skip Navigation

[Resolved] But how to display only the sessions of the selected day in the calendar?

This support ticket is created 3 years, 7 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
- 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9:00 – 13:00 9: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/Hong_Kong (GMT+08:00)

This topic contains 28 replies, has 2 voices.

Last updated by guillaumeM-4 3 years, 7 months ago.

Assisted by: Luo Yang.

Author
Posts
#2403203

Great job, thank you!

But how to display only the sessions of the selected day in the calendar?
And is it possible, that when loading the page, it is displayed only the sessions of the current date (and not other dates)?

To go further in the use of Toolset and the personalization of the site, I added a 'group of repeatable fields' in the CPT 'Filmovie': 'SessionV2'.
Is it possible to display the information of each session on the font-end?
Ex: WEDNESDAY 22/06 13:45 (VF)(2D) | 17:00 (VOSTFR)(2D) | 18:00 (VF)(2D)

#2403323

Hello,

Unfortunately, there isn't such kind of built-in feature within Toolset plugins, it needs custom codes, for example:
1) Create a custom shortcode with your custom PHP function:
https://developer.wordpress.org/reference/functions/add_shortcode/

2) In this PHP function, you can:
- get the user searched date value with PHP variable
hidden link
- Get custom field "wpcf-session-date-ts" field value:
https://developer.wordpress.org/reference/functions/get_post_meta/
- compare those values, and output as what you want

#2403373
2402503-Capture_d_e_cran_2022_06_22_a_07.31.47.png

This seems too complicated for me and beyond my skills 🙁

So it's not possible to display the elements of the 'repeatable field group' as in the image?

#2403387
2402503-Capture_d_e_cran_2022_06_22_a_07.31.47.png

This seems complicated and beyond my skills 🙁
So it's not possible to display the elements of the 'repeatable field group' as in the image?

#2403413

Nope, as I mentioned in your previous thread, in order to filter the result by custom date field, it needs to setup the date field in same post type "Filmovies", so in your case, it is not recommended to use "repeatable field group", since it is another post types.

According to our support policy, we don't provide custom codes support, but please let me know if you need more assistance for it, I can try to setup a demo in your website.

#2403417
2403387-2402503_Capture_d_e_cran_2022_06_22_a_07.31.47.png

I'm not sure I understand when you say it's another post types, since the 'repeatable field group' is in the 'Filmovie' CPT?
Can you help me to display the 'repeatable field group' as desired in the image?

#2403463

As I mentioned in your previous thread, Toolset repeatable field group is based on one-to-many relationship, so each item of repeatable field group is also a single post, and "Session" is different post type from "Filmovies", hope it is clear.

In order to display the as your screenshot using custom date field "session-date-ts", it needs to create custom codes, please let me know if you need assistance for it.

#2403477

Ok, I understand better, thank you.

If it is possible I would like your assistance to create the custom codes.

#2404065

Thanks for the confirmation, I have setup a demo in your website:
1) Dashboard-> Toolset-> Settings-> Custom codes, add one item "grouped-date", with below codes:

add_shortcode('grouped-date', function($atts, $content){
    $atts = shortcode_atts( array(
        'field' => 'wpcf-session-date-ts',
        'date' => 'wpv-wpcf-session-date-ts'
    ), $atts);
  	$res = '';
  	if(isset($_GET[$atts['date']])){
        $start  = $_GET[$atts['date']];
      	$end = $start + 3600 * 24;
  		$date = get_post_meta(get_the_ID(), $atts['field'], false);
  		sort($arr);
      	$res .= wp_date('l d/m', $start, 'Europe/Paris') . ': <ul>';
        foreach($date as $v){
            if($v > $start && $v <= $end){
              	$res .= sprintf('<li>%1$s</li>', wp_date('H:i', $v,  'Europe/Paris'));
            }
        }
      	$res .= '</ul>';
    }
  	return $res;
});

2) Edit post view:
hidden link
in section "Loop item in myView3", add lines 47~49:

      <hr>
      [grouped-date]
      <hr>

It will output grouped date when user search by a date, for example:
hidden link

It is only a demo for your reference, you need to customize it to what you want

#2404411
Capture d’écran 2022-06-24 à 17.29.11.png

This is really great! Thanks!

Unfortunately the design is not displayed as expected...
I want to display as in the picture (the timetable in a Bootstrap badge).

Do you think achieving this result is possible?

#2405565
css-class2.jpg

I seems that you have already added the CSS class name into the custom PHP codes, it works fine in your website, see my screenshot css-class2.jpg

Is this issue resolved? please let me know if you need more assistance for it. thanks

#2405719
2404411-Capture_d_e_cran_2022_06_24_a_17.29.11.png

I added CSS (Bootstrap) code to your PHP code.
Thanks! Everything works, it's great!

How can I display the 'repeatable field group' information as described on the image (language and 2D or 3D)?
Is this possible? Should I open a new ticket to process the request?

#2405771

As I answered above, there isn't such kind of built-in feature to display the result as what you want using "repeatable field group".

In your case, since you are filtering "Filmovies" posts by custom date field "session-date-ts", it is required to setup the date field "session-date-ts" into "Filmovies" post type, and it is not recommended to use "repeatable field group" in this case.

#2406283

It seems that we did not understand each other.

I wish to use the 'repeatable field group' instead of the 'session-date-ts' field to display the schedule times of the 'Filmovie' movies. This will ask me to add information such as '2D or 3D' and 'VO, VOSTFR or VF' for each session.
Do you think this is impossible?

Once again thank you very much for your help and the time you spend on my problem.

#2406637

Nope, In your case, you can not use the 'repeatable field group' instead of the 'session-date-ts' field.

In your case, you can not filter the 'Filmovie' posts by custom fields of 'repeatable field group', you can only filter the result by "session-date-ts" field.

So you need to setup the date-time field twice:
- 'session-date-ts' field in post type Filmovie
- custom date field in 'repeatable field group'

Then you can:
1) Use 'session-date-ts' field for filter the results(frontend custom search form)
2) Use 'repeatable field group' to display the results
https://toolset.com/course-lesson/creating-and-displaying-repeatable-field-groups/#displaying-repeatable-field-groups