Skip to content

Commit 33234df

Browse files
author
Chris Gårdenberg
committed
fix: Only check description if it actually contains anything
1 parent 20acdad commit 33234df

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

content/template/data/ogp.php

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,13 +39,19 @@
3939
$selected_course = json_decode( EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city ), true );
4040
}
4141

42+
$description = ! empty( $selected_course['CourseDescriptionShort'] ) ?
43+
$selected_course['CourseDescriptionShort'] :
44+
$selected_course['CourseDescription'];
45+
46+
if ( $description == null || strlen( $description ) == 0 ) {
47+
return;
48+
}
49+
4250
$description = wp_strip_all_tags(
4351
str_replace(
4452
[ "<br />", "<br>", "</p>" ],
4553
[ "&#xA;", "&#xA;", "</p>&#xA;&#xA;" ],
46-
! empty( $selected_course['CourseDescriptionShort'] ) ?
47-
$selected_course['CourseDescriptionShort'] :
48-
$selected_course['CourseDescription']
54+
$description
4955
)
5056
);
5157

0 commit comments

Comments
 (0)