diff --git a/theme/components/NewsCard/NewsCardComponent.php b/theme/components/NewsCard/NewsCardComponent.php index c305b0a..eabf3d9 100644 --- a/theme/components/NewsCard/NewsCardComponent.php +++ b/theme/components/NewsCard/NewsCardComponent.php @@ -24,6 +24,7 @@ protected function get_options() 'content' => [], 'image' => [], 'source' => [], + 'embedded' => [], 'link' => [ 'default' => '#' ] @@ -32,6 +33,10 @@ protected function get_options() protected function get_template_path($args, $instance) { + if (sizeof($instance['embedded']) > 0) { + return 'components/NewsCard/news_card_embedded_template.php'; + } + if (! $instance['image']) { return 'components/NewsCard/news_card_no_image_template.php'; } diff --git a/theme/components/NewsCard/news_card.scss b/theme/components/NewsCard/news_card.scss index fdd5ac9..18f085d 100644 --- a/theme/components/NewsCard/news_card.scss +++ b/theme/components/NewsCard/news_card.scss @@ -8,6 +8,7 @@ $news-card-size: 300px; overflow: hidden; flex: 1 0 $news-card-size; + flex-direction: column; background-size: cover; background-position: center; @@ -16,6 +17,11 @@ $news-card-size: 300px; color: $gray; } + .news-card__embedded > iframe { + max-width: 100% !important; + max-height: $news-card-size !important; + } + .news-card__caption { padding: 15px; diff --git a/theme/components/NewsCard/news_card_embedded_template.php b/theme/components/NewsCard/news_card_embedded_template.php new file mode 100644 index 0000000..32871f3 --- /dev/null +++ b/theme/components/NewsCard/news_card_embedded_template.php @@ -0,0 +1,13 @@ +
+
+ +
+ +
+

+

+ +
+

+
+
diff --git a/theme/templates/module-news.php b/theme/templates/module-news.php index 2d1277c..99a775f 100644 --- a/theme/templates/module-news.php +++ b/theme/templates/module-news.php @@ -38,13 +38,16 @@ ?>
have_posts() && $i < 6; $i++ ) : $sticky->the_post(); ?> - get_the_title(), - 'source' => get_post_meta(get_the_ID(), 'source_title', true), - 'content' => strip_tags(get_the_excerpt()), - 'link' => get_the_permalink(), - 'image' => get_the_post_thumbnail_url(null, 'medium'), - ]); ?> + get_the_title(), + 'source' => get_post_meta(get_the_ID(), 'source_title', true), + 'content' => strip_tags(get_the_excerpt()), + 'link' => get_the_permalink(), + 'image' => get_attached_media('image')[0]->guid, + 'embedded' => get_media_embedded_in_content(apply_filters( 'the_content', get_the_content())) + ]); + ?>