Skip to content

Commit e6ccf5a

Browse files
committed
Desktop course page
1 parent 08554eb commit e6ccf5a

18 files changed

+285
-432
lines changed

acf-json/group_5fb5ac20ee356.json

-67
This file was deleted.

acf-json/group_5fbc44d240d7e.json

+151
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
{
2+
"key": "group_5fbc44d240d7e",
3+
"title": "Event Data",
4+
"fields": [
5+
{
6+
"key": "field_5fbc44deaa83a",
7+
"label": "",
8+
"name": "",
9+
"type": "message",
10+
"instructions": "",
11+
"required": 0,
12+
"conditional_logic": 0,
13+
"wrapper": {
14+
"width": "",
15+
"class": "",
16+
"id": ""
17+
},
18+
"message": "An event is a single session of a course. Events should not be re-used, instead new events should be created every time there's a new session of a course. This way we have a history of all sessions that have run.",
19+
"new_lines": "wpautop",
20+
"esc_html": 0
21+
},
22+
{
23+
"key": "field_5fbc4555b473e",
24+
"label": "Related Course",
25+
"name": "related_course",
26+
"type": "post_object",
27+
"instructions": "",
28+
"required": 1,
29+
"conditional_logic": 0,
30+
"wrapper": {
31+
"width": "",
32+
"class": "",
33+
"id": ""
34+
},
35+
"post_type": [
36+
"cc_course"
37+
],
38+
"taxonomy": "",
39+
"allow_null": 0,
40+
"multiple": 0,
41+
"return_format": "id",
42+
"ui": 1
43+
},
44+
{
45+
"key": "field_5fbc45d297a5a",
46+
"label": "Start Date",
47+
"name": "start_date",
48+
"type": "date_picker",
49+
"instructions": "",
50+
"required": 0,
51+
"conditional_logic": 0,
52+
"wrapper": {
53+
"width": "50",
54+
"class": "",
55+
"id": ""
56+
},
57+
"display_format": "m\/d\/Y",
58+
"return_format": "F d",
59+
"first_day": 1
60+
},
61+
{
62+
"key": "field_5fbc460797a5b",
63+
"label": "End Date",
64+
"name": "end_date",
65+
"type": "date_picker",
66+
"instructions": "",
67+
"required": 0,
68+
"conditional_logic": 0,
69+
"wrapper": {
70+
"width": "50",
71+
"class": "",
72+
"id": ""
73+
},
74+
"display_format": "m\/d\/Y",
75+
"return_format": "F d",
76+
"first_day": 1
77+
},
78+
{
79+
"key": "field_5fbc463597a5d",
80+
"label": "Location",
81+
"name": "location",
82+
"type": "text",
83+
"instructions": "",
84+
"required": 0,
85+
"conditional_logic": 0,
86+
"wrapper": {
87+
"width": "",
88+
"class": "",
89+
"id": ""
90+
},
91+
"default_value": "",
92+
"placeholder": "",
93+
"prepend": "",
94+
"append": "",
95+
"maxlength": ""
96+
},
97+
{
98+
"key": "field_5fbc461197a5c",
99+
"label": "Registration URL",
100+
"name": "registration_url",
101+
"type": "url",
102+
"instructions": "Defaults to the global registration url on the options page; can also be overwritten here.",
103+
"required": 0,
104+
"conditional_logic": 0,
105+
"wrapper": {
106+
"width": "",
107+
"class": "",
108+
"id": ""
109+
},
110+
"default_value": "",
111+
"placeholder": ""
112+
},
113+
{
114+
"key": "field_5fbc62f98d54c",
115+
"label": "Language",
116+
"name": "language",
117+
"type": "text",
118+
"instructions": "",
119+
"required": 0,
120+
"conditional_logic": 0,
121+
"wrapper": {
122+
"width": "",
123+
"class": "",
124+
"id": ""
125+
},
126+
"default_value": "",
127+
"placeholder": "",
128+
"prepend": "",
129+
"append": "",
130+
"maxlength": ""
131+
}
132+
],
133+
"location": [
134+
[
135+
{
136+
"param": "post_type",
137+
"operator": "==",
138+
"value": "cc_events"
139+
}
140+
]
141+
],
142+
"menu_order": 0,
143+
"position": "normal",
144+
"style": "default",
145+
"label_placement": "top",
146+
"instruction_placement": "label",
147+
"hide_on_screen": "",
148+
"active": true,
149+
"description": "",
150+
"modified": 1606181628
151+
}

assets/css/child-styles.css

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

front/src/styles/modules.scss

+10
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,16 @@
307307

308308
// Course template
309309
&.single-cc_course {
310+
.course-meta {
311+
display: flex;
312+
column-gap: $space-normal;
313+
margin-top: $space-big;
314+
315+
li {
316+
margin-bottom: $space-small;
317+
}
318+
}
319+
310320
.single-header--course {
311321
padding-top: 0;
312322
background-color: $grey-lighter !important;

front/src/styles/shame.scss

+6
Original file line numberDiff line numberDiff line change
@@ -168,3 +168,9 @@ main {
168168
}
169169
}
170170
}
171+
.fixed-card.fixed-card--simple {
172+
width: 100%;
173+
display: flex;
174+
justify-content: flex-start;
175+
align-items: center;
176+
}

functions.php

-2
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@
1515
*/
1616
require STYLESHEETPATH . '/inc/custom-post-types/queulat-cc-course-cpt-plugin/cc-course-cpt-plugin.php';
1717
require STYLESHEETPATH . '/inc/custom-post-types/queulat-cc-events-cpt-plugin/cc-events-cpt-plugin.php';
18-
require STYLESHEETPATH . '/inc/custom-post-types/queulat-cc-scholarships-cpt-plugin/cc-scholarships-cpt-plugin.php';
19-
require STYLESHEETPATH . '/inc/custom-post-types/queulat-cc-testimonials-cpt-plugin/cc-testimonials-cpt-plugin.php';
2018

2119
/* Include local files */
2220
require STYLESHEETPATH . '/inc/certificates-functions.php';

inc/certificates-functions.php

+55-2
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,44 @@ public static function add_body_class( $classes ) {
1313
}
1414
public static function modify_breadcrumb_seperator() {
1515
return '<i class="icon chevron-right is-6"></i>';
16+
}
17+
public static function get_upcoming_course_events( $post_id ) {
18+
$posts = get_posts( array(
19+
'posts_per_page' => -1,
20+
'post_type' => 'cc_events',
21+
'meta_key' => 'start_date',
22+
'orderby' => 'meta_value_num',
23+
'order' => 'ASC',
24+
'meta_query' => array(
25+
array(
26+
'key' => 'related_course',
27+
'compare' => '=',
28+
'value' => $post_id
29+
),
30+
array(
31+
'key' => 'start_date',
32+
'compare' => '>=',
33+
'value' => date('Ymd')
34+
),
35+
)
36+
) );
37+
38+
return $posts;
1639
}
17-
public static function get_upcoming_course_events() {
18-
return array( 'wow' );
40+
41+
public static function get_upcoming_course_meta( $events ) {
42+
$upcoming_id = $events[0]->ID;
43+
$start = get_field( 'start_date', $upcoming_id );
44+
$end = get_field( 'end_date', $upcoming_id );
45+
46+
return array(
47+
'start_date' => $start,
48+
'end_date' => $end,
49+
'duration' => numWeeks( $start, $end ),
50+
'language' => get_field( 'language', $upcoming_id ),
51+
);
1952
}
53+
2054
public static function register_columns_shortcode( $atts, $content ) {
2155
$a = shortcode_atts( array( 'cols' => '4' ), $atts );
2256
return '<div class="cols" style="--col-count: ' . $a['cols'] . ';">' . $content . '</div>';
@@ -95,3 +129,22 @@ function load_org_blog_posts() {
95129

96130
return $posts;
97131
}
132+
133+
134+
/*
135+
* A custom function that calculates how many weeks occur
136+
* between two given dates.
137+
*
138+
* @param string $dateOne Y-m-d format.
139+
* @param string $dateTwo Y-m-d format.
140+
* @return int
141+
*/
142+
function numWeeks($dateOne, $dateTwo){
143+
$firstDate = new DateTime($dateOne);
144+
$secondDate = new DateTime($dateTwo);
145+
146+
$differenceInDays = $firstDate->diff($secondDate)->days;
147+
$differenceInWeeks = $differenceInDays / 7;
148+
149+
return floor($differenceInWeeks);
150+
}

inc/custom-post-types/queulat-cc-events-cpt-plugin/cc-events-cpt-plugin.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ function Cc_events_Post_Type_register_post_type() {
1414
include_once __DIR__ . '/class-cc-events-post-type.php';
1515
include_once __DIR__ . '/class-cc-events-post-query.php';
1616
include_once __DIR__ . '/class-cc-events-post-object.php';
17-
include_once __DIR__ . '/class-cc-events-post-metabox.php';
17+
// include_once __DIR__ . '/class-cc-events-post-metabox.php';
1818
}
1919

2020
add_action( 'init', 'Cc_events_Post_Type_register_post_type' );

inc/custom-post-types/queulat-cc-scholarships-cpt-plugin/cc-scholarships-cpt-plugin.php

-19
This file was deleted.

inc/custom-post-types/queulat-cc-scholarships-cpt-plugin/class-cc-scholarships-post-object.php

-8
This file was deleted.

inc/custom-post-types/queulat-cc-scholarships-cpt-plugin/class-cc-scholarships-post-query.php

-16
This file was deleted.

0 commit comments

Comments
 (0)