Skip to content

Commit

Permalink
fix: Only check description if it actually contains anything
Browse files Browse the repository at this point in the history
  • Loading branch information
itssimple committed Feb 22, 2024
1 parent 20acdad commit 33234df
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions content/template/data/ogp.php
Expand Up @@ -39,13 +39,19 @@
$selected_course = json_decode( EDUAPIHelper()->GetOnDemandCourseDetailInfo( $course_id, $group_by_city ), true );
}

$description = ! empty( $selected_course['CourseDescriptionShort'] ) ?
$selected_course['CourseDescriptionShort'] :
$selected_course['CourseDescription'];

if ( $description == null || strlen( $description ) == 0 ) {
return;
}

$description = wp_strip_all_tags(
str_replace(
[ "<br />", "<br>", "</p>" ],
[ "&#xA;", "&#xA;", "</p>&#xA;&#xA;" ],
! empty( $selected_course['CourseDescriptionShort'] ) ?
$selected_course['CourseDescriptionShort'] :
$selected_course['CourseDescription']
$description
)
);

Expand Down

0 comments on commit 33234df

Please sign in to comment.