Skip to content

Commit

Permalink
News-Teaser verbessert
Browse files Browse the repository at this point in the history
  • Loading branch information
cassandre committed Jul 18, 2024
1 parent b80487c commit 2da73dc
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
11 changes: 8 additions & 3 deletions includes/News/News.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public function shortcodeCustomNews($atts) {
'forcelandscape' => 'false',
'force_landscape' => 'false',
'sticky_only' => 'false',
'teaser_length' => '0',
'teaser_length' => '55',
], $atts);
$sc_atts = array_map('sanitize_text_field', $sc_atts);

Expand Down Expand Up @@ -306,6 +306,7 @@ function ($post_ID) {
'thumbnailSize' => $thumbnailSize,
'forceLandscape' => $forceLandscape,
'showContent' => (in_array('show_content', $mode) ? true : false),
'teaserLength' => $teaserLength,
];
$output .= (new Columns())->shortcodeColumn([], $this->display_news_teaser($args));
} elseif (!empty($postCols)) {
Expand All @@ -322,6 +323,7 @@ function ($post_ID) {
'thumbnailSize' => $thumbnailSize,
'forceLandscape' => $forceLandscape,
'showContent' => (in_array('show_content', $mode) ? true : false),
'teaserLength' => $teaserLength,
];
$output .= do_shortcode($this->display_news_teaser($args));
} else {
Expand Down Expand Up @@ -404,8 +406,9 @@ private function display_news_teaser($argsRaw) {
'postCols' => [],
'thumbnailSize' => 'large',
'forceLandscape'=> false,
'teaserLength' => 20,
];
if ($argsRaw['id'] == 0) return;
if ($argsRaw['id'] == 0) return '';
$args = wp_parse_args($argsRaw, $defaults);
foreach ($args as $k => $v) {
${$k} = $v;
Expand Down Expand Up @@ -500,7 +503,9 @@ private function display_news_teaser($argsRaw) {
$abstract .= fau_create_readmore($permalink, get_the_title(), false, true);
}
} else {
$abstract = get_the_excerpt($id);
$excerpt = get_the_excerpt($id);
$excerpt_more = apply_filters( 'excerpt_more', '…' );
$abstract = wp_trim_words( $excerpt, $teaserLength, $excerpt_more );
}
} else {
if (function_exists('fau_create_readmore')) {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "rrze-elements",
"version": "1.28.2",
"version": "1.28.4",
"description": "RRZE Elements: Gestalterische Erweiterungen für Webauftritte.",
"main": "rrze-elements.php",
"textdomain": "rrze-elements",
Expand Down
4 changes: 2 additions & 2 deletions rrze-elements.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Plugin Name: RRZE Elements
Plugin URI: https://github.com/RRZE-Webteam/rrze-elements
Description: Advanced design elements for WordPress websites.
Version: 1.28.3
Version: 1.28.4
Author: RRZE Webteam
Author URI: https://blogs.fau.de/webworking/
License: GNU General Public License v2
Expand All @@ -23,7 +23,7 @@

const RRZE_PHP_VERSION = '7.4';
const RRZE_WP_VERSION = '5.9';
const RRZE_ELEMENTS_VERSION = '1.28.2';
const RRZE_ELEMENTS_VERSION = '1.28.4';

spl_autoload_register(function ($class) {
$prefix = __NAMESPACE__;
Expand Down

0 comments on commit 2da73dc

Please sign in to comment.