diff --git a/wp-content/themes/vf-wp-intranet/acf-json/training.json b/wp-content/themes/vf-wp-intranet/acf-json/training.json
index 8c6abbbc3..89ee2ffa5 100644
--- a/wp-content/themes/vf-wp-intranet/acf-json/training.json
+++ b/wp-content/themes/vf-wp-intranet/acf-json/training.json
@@ -317,7 +317,7 @@
"key": "field_649d474f51c90",
"label": "Alternative dates",
"name": "vf-wp-training-alternative",
- "type": "repeater",
+ "type": "relationship",
"instructions": "",
"required": 0,
"conditional_logic": 0,
@@ -326,30 +326,17 @@
"class": "",
"id": ""
},
- "collapsed": "",
- "min": 0,
- "max": 0,
- "layout": "table",
- "button_label": "Next date",
- "sub_fields": [
- {
- "key": "field_649d477151c91",
- "label": "Date",
- "name": "vf-wp-training-alternative-date",
- "type": "date_picker",
- "instructions": "",
- "required": 0,
- "conditional_logic": 0,
- "wrapper": {
- "width": "",
- "class": "",
- "id": ""
- },
- "display_format": "j M Y",
- "return_format": "j M Y",
- "first_day": 1
- }
- ]
+ "post_type": [
+ "training"
+ ],
+ "taxonomy": "",
+ "filters": [
+ "search"
+ ],
+ "elements": "",
+ "min": "",
+ "max": "",
+ "return_format": "object"
}
],
"location": [
@@ -368,6 +355,5 @@
"instruction_placement": "label",
"hide_on_screen": "",
"active": true,
- "description": "",
- "modified": 1690285448
+ "description": ""
}
\ No newline at end of file
diff --git a/wp-content/themes/vf-wp-intranet/archive-training.php b/wp-content/themes/vf-wp-intranet/archive-training.php
index 1dd6b199b..b49e2976d 100644
--- a/wp-content/themes/vf-wp-intranet/archive-training.php
+++ b/wp-content/themes/vf-wp-intranet/archive-training.php
@@ -6,45 +6,64 @@
$today_date = date('Ymd');
?>
-
+
-
- Training catalogue
+
+ Professional Development Training Catalogue
- Short description and invitation to browse
-
+
Improve your skills in communication, management and leadership; learn a language,
+ or find support for planning your career.
+
-
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sapiente harum, omnis provident
+
+
+
+
+
+
Sapiente harum, omnis provident
+
+
+
+
+
+
+
+
-
-
-
-
-
-
Sapiente harum, omnis provident
+
-
-
-
-
-
-
Sapiente harum, omnis provident
-
-
-
-
-
-
false,
'taxonomies' => array(
'training-organiser',
- 'embl-location',
+ 'event-location',
),
));
diff --git a/wp-content/themes/vf-wp-intranet/functions/training.php b/wp-content/themes/vf-wp-intranet/functions/training.php
new file mode 100644
index 000000000..c951fa6fc
--- /dev/null
+++ b/wp-content/themes/vf-wp-intranet/functions/training.php
@@ -0,0 +1,82 @@
+ array('training'), // post types you want to check
+ 'posts_per_page' => -1
+ );
+ $posts = get_posts($args);
+ foreach($posts as $p){
+ $expiredate = get_field('vf-wp-training-start_date', $p->ID, false, false); // get the raw date from the db
+ if ($expiredate) {
+ if($expiredate <= $today){
+ $postdata = array(
+ 'ID' => $p->ID,
+ 'post_status' => 'draft'
+ );
+ wp_update_post($postdata);
+ }
+ }
+ }
+}
+
+// adds settings to run cron and unpublish trainings manually
+
+add_action('admin_menu', 'unpublish_training_menu');
+
+function unpublish_training_menu(){
+ add_submenu_page('edit.php?post_type=training', 'Training settings', 'Settings', 'manage_options', 'training-slug', 'unpublish_training_admin_page');
+}
+
+function unpublish_training_admin_page() {
+ if (!current_user_can('manage_options')) {
+ wp_die( __('You do not have sufficient pilchards to access this page.') );
+ }
+ // Start building the page
+ echo '
';
+ echo '
Unpublish past trainings manually ';
+ // Check whether the button has been pressed AND also check the nonce
+ if (isset($_POST['unpublish_training']) && check_admin_referer('unpublish_training_clicked')) {
+ // the button has been pressed AND we've passed the security check
+ expire_trainings_function();
+ }
+ echo '';
+ echo '';
+
+}
+
+// excludes drafts posts from the alternative dates selection
+add_filter( 'acf/fields/relationship/query','relationship_options_filter', 10, 3);
+
+function relationship_options_filter($options, $field, $the_post) {
+
+ $options['post_status'] = array('publish');
+ $options['meta_key'] = 'vf-wp-training-start_date';
+ $options['orderby'] = 'meta_value';
+ $options['order'] = 'ASC';
+
+ return $options;
+}
+
+add_filter('acf/fields/relationship/result', 'my_acf_fields_relationship_result', 10, 4);
+function my_acf_fields_relationship_result( $text, $post, $field, $post_id ) {
+ $startDate = get_field( 'vf-wp-training-start_date', $post->ID );
+ if( $startDate ) {
+ $text .= ' ' . sprintf( '(%s)', $startDate );
+ }
+ return $text;
+}
+
+?>
\ No newline at end of file
diff --git a/wp-content/themes/vf-wp-intranet/partials/training-filter.php b/wp-content/themes/vf-wp-intranet/partials/training-filter.php
index 3ec96bfa9..6ea82540b 100644
--- a/wp-content/themes/vf-wp-intranet/partials/training-filter.php
+++ b/wp-content/themes/vf-wp-intranet/partials/training-filter.php
@@ -25,7 +25,7 @@
@@ -87,24 +87,6 @@
-
- Status
-
-
- Open
-
-
-
- Closed
-
-
-
Location
name); ?>"
+ data-path=".location-slug); ?>"
data-mode="static"
- data-name="counter-location-name); ?>"
+ data-name="counter-location-slug); ?>"
data-filter-type="path">
diff --git a/wp-content/themes/vf-wp-intranet/partials/vf-summary--training.php b/wp-content/themes/vf-wp-intranet/partials/vf-summary--training.php
index fcbd05471..28d3a3095 100644
--- a/wp-content/themes/vf-wp-intranet/partials/vf-summary--training.php
+++ b/wp-content/themes/vf-wp-intranet/partials/vf-summary--training.php
@@ -59,16 +59,12 @@
else {
echo $start->format('j F Y');
}
- if ($start_time) {
- echo ', ' . $start_time;
- }
- if ($end_time) {
- echo ' - '. $end_time . ' CET';
- } ?>
- |
- Add to calendar
-
+ // if ($start_time) {
+ // echo ', ' . $start_time;
+ // }
+ // if ($end_time) {
+ // echo ' - '. $end_time . ' CET';
+ // } ?>
@@ -81,20 +77,20 @@
- name; }
+ $org_list[] = strtolower(str_replace(' ', '-', $org->name)); }
echo implode(', ', $org_list); ?>">
name; }
+ $org_list[] = strtoupper($org->name); }
echo implode(', ', $org_list); ?>
Location:
- name; }
+ $loc_list[] = strtolower($loc->name); }
echo implode(' ', $loc_list); ?>">
diff --git a/wp-content/themes/vf-wp-intranet/single-training.php b/wp-content/themes/vf-wp-intranet/single-training.php
index 4bf6c17b4..8f49153aa 100644
--- a/wp-content/themes/vf-wp-intranet/single-training.php
+++ b/wp-content/themes/vf-wp-intranet/single-training.php
@@ -25,6 +25,7 @@
$venue = get_field('vf-wp-training-venue',$post_id);
$contact = get_field('vf-wp-training-contact',$post_id, false, false);
$additionalInfo = get_field('vf-wp-training-info',$post_id);
+$alternative_dates = get_field('vf-wp-training-alternative', $post_id);
@@ -67,11 +68,11 @@
-
+
'vf-figure__image')); ?>
- Date:
+
Date:
format('j M Y');
} }
?>
- |
-
+
+
Time:
@@ -174,7 +175,7 @@
= $current_date)) || (($registrationStatus == 'Open'))) { ?>
+ if ((($registrationDeadlineFormatted >= $current_date)) || (($registrationStatus == 'Open')) || (($registrationStatus == 'Waiting list only'))) { ?>
Register
@@ -195,22 +196,25 @@ class="vf-u-text-color--grey | vf-u-margin__right--600 | organiser">
+
+if( $alternative_dates ): ?>
Alternative
dates:
-
-
-
+ ID );
+ $alternativeStartDate = get_field( 'vf-wp-training-start_date', $alternative_date->ID );
+ ?>
+
+
+
+
-
-
diff --git a/wp-content/themes/vf-wp-intranet/style.css b/wp-content/themes/vf-wp-intranet/style.css
index da540fcfd..1c2a5fbc5 100644
--- a/wp-content/themes/vf-wp-intranet/style.css
+++ b/wp-content/themes/vf-wp-intranet/style.css
@@ -62,4 +62,8 @@ Text Domain: vfwp
#trainingMeta .vf-badge {
font-size: 14px;
font-weight: 500;
+}
+
+#typeTraining .vf-tabs__section {
+ padding: 0px
}
\ No newline at end of file