diff --git a/includes/News/News.php b/includes/News/News.php index 58815c39..6c42a190 100644 --- a/includes/News/News.php +++ b/includes/News/News.php @@ -18,6 +18,7 @@ public function __construct() { add_shortcode('custom-news', [$this, 'shortcodeCustomNews']); add_shortcode('blogroll', [$this, 'shortcodeCustomNews']); + add_filter( 'the_seo_framework_query_supports_seo', [$this, 'disableTSF']); } /** @@ -188,8 +189,8 @@ function ($post_ID) { $args['post__in'] = $id; } - if($hideDuplicates && isset($GLOBALS['a_displayedPosts']) && is_array($GLOBALS['a_displayedPosts'])) { - $args['post__not_in'] = array_unique($GLOBALS['a_displayedPosts']); + if($hideDuplicates && isset($GLOBALS['a_rrze_elements_displayed_posts']) && is_array($GLOBALS['a_rrze_elements_displayed_posts'])) { + $args['post__not_in'] = array_unique($GLOBALS['a_rrze_elements_displayed_posts']); } if ($hasThumbnail) { @@ -275,7 +276,7 @@ function ($post_ID) { if (filter_var($externalLink, FILTER_VALIDATE_URL) !== false) { $permalink = $externalLink; } - $GLOBALS['a_displayedPosts'][] = $id; + $GLOBALS['a_rrze_elements_displayed_posts'][] = $id; $args = []; if ($display == 'list') { @@ -419,8 +420,9 @@ private function display_news_teaser($argsRaw) { if (filter_var($externalLink, FILTER_VALIDATE_URL) !== false) { $permalink = $externalLink; } - if (has_post_thumbnail($id) && ! $hide_thumbnail) { - $image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), $thumbnailSize ); + $displayThumbnail = false; + if (has_post_thumbnail($id) && ! $hide_thumbnail && $image_data = wp_get_attachment_image_src( get_post_thumbnail_id( $id ), $thumbnailSize )) { + $displayThumbnail = true; if ($forceLandscape) { $ratioClass = 'ratio-landscape'; } else { @@ -441,7 +443,7 @@ private function display_news_teaser($argsRaw) { $output .= '[columns number="'. $numCols .'"][column span="' . $postCols['left'] . '"]'; } - if (has_post_thumbnail($id) && ! $hide_thumbnail && $imgFirst) { + if ($displayThumbnail && $imgFirst && $image_data) { $output .= '
'; - if (has_post_thumbnail($id) && ! $hide_thumbnail && !$imgFirst) { + if ($displayThumbnail && !$imgFirst) { $output .= '