Liebe Community,
ich möchte gerne in den Auszügen/excerpts die drei Punkte am Ende löschen. Es gibt in diesem Forum einige Wege das zu tun, z.B. in dem man folgenden Code in die functions.php einfügt:
Code
function trim_excerpt($text)
{
return rtrim($text,'[...]');
}
add_filter('get_the_excerpt', 'trim_excerpt');
Das hat aber nicht geklappt.. Ein Addon/Plugin zur Excerpt-Verwaltung geht auch nicht, egal was ich einstelle, es ändert sich nix. Vielleicht liegt es auch am Theme (nutze Adapt 2.0 von WPExplorer), das hat ein eigenes excerpt.php file. Allerdings: Das haben manch andere Themes ja auch!???
So sieht die excerpts.php aus:
PHP
<?php
/**
* Custom excerpts based on wp_trim_words
* Created for child-theming purposes
*
* Learn more at http://codex.wordpress.org/Function_Reference/wp_trim_words
*
* @since 2.0
*/
if ( !function_exists( 'wpex_excerpt' ) ) :
function wpex_excerpt($length=25, $readmore=true ) {
global $post;
$id = $post->ID;
$meta_excerpt = get_post_meta( $id, 'wpex_excerpt_length', true );
$length = $meta_excerpt ? $meta_excerpt : $length;
if ( has_excerpt( $id ) ) {
$output = $post->post_excerpt;
} else {
$output = wp_trim_words( strip_shortcodes( get_the_content( $id ) ), $length);
if ( $readmore == true ) {
$readmore_link = '<br /><a href="'. get_permalink( $id ) .'" title="'. __(' weiterlesen', 'wpex' ) .'" rel="bookmark" class="readmore-link">'. __(' weiterlesen', 'wpex' ) .' →</a>';
$output .= apply_filters( 'wpex_readmore_link', $readmore_link );
}
}
echo $output;
}
endif;
/**
* Change default read more style
* @since 2.0
*/
add_filter('excerpt_more', 'wpex_excerpt_more', 'get_the_excerpt', 'trim_excerpt');
if ( !function_exists( 'wpex_excerpt_more' ) ) :
function wpex_excerpt_more($more) {
global $post;
return ('...'); // removing this dots doesn't change anything
}
endif;
/**
* Change default excerpt length
* @since 2.0
*/
add_filter( 'excerpt_length', 'wpex_custom_excerpt_length', 999 );
if ( !function_exists( 'wpex_custom_excerpt_length' ) ) :
function wpex_custom_excerpt_length( $length ) {
return wpex_get_data('excerpt_length','25');
}
endif;
Alles anzeigen
Ich würde mich sehr freuen, wenn mir jemand helfen kann. Ich hab schon einen ganzen Tag zugebracht eine Lösung zu finden - ohne Ergebnis.
Herzlichen Dank für Eure/Deine Antwort(en).