Bullets in excerpt anzeigen

    • Anzeige

    Hallo!

    Wenn du gerade an deiner Website arbeitest oder dein aktuelles Hosting überdenkst: Wir betreiben mit NetzLiving eine Hosting-Plattform, die speziell auf Performance, Sicherheit und einfache Verwaltung ausgelegt ist.

    • ✔️ Schnelle Ladezeiten (optimiert für WordPress & Co.)
    • ✔️ Deutsche Server & DSGVO-konform
    • ✔️ Persönlicher Support (kein 0815-Ticket-System)

    Mehr erfahren

  • Verwende folgenden Code für excerpt in der functions.php:

    // Länge der Seminarbeiträge in der Übersicht
    function custom_trim_excerpt($text) { // Fakes an excerpt if needed
    global $post;

    if ( '' == $text ) {
    $text = get_the_content('');
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $text = strip_tags($text);
    $excerpt_length = 60;
    $words = explode(' ', $text, $excerpt_length + 1);
    if (count($words)> $excerpt_length) {
    array_pop($words);
    array_push($words, '...<a class="moretag" href="'. get_permalink($words->ID) . '"> Ganzen Beitrag lesen</a>');
    $text = implode(' ', $words);
    }

    }
    if ( is_search('' == $text )) {
    $text = get_the_content('');
    $text = apply_filters('the_content', $text);
    $text = str_replace(']]>', ']]>', $text);
    $text = strip_tags($text);
    $excerpt_length = 30;
    $words = explode(' ', $text, $excerpt_length + 1);
    if (count($words)> $excerpt_length) {
    array_pop($words);
    array_push($words, '...<a class="moretag" href="'. get_permalink($words->ID) . '"> Ganzen Beitrag lesen</a>');
    $text = implode(' ', $words);
    }

    }


    return $text;


    }


    remove_filter('get_the_excerpt', 'wp_trim_excerpt');
    add_filter('get_the_excerpt', 'custom_trim_excerpt');


    ?>

  • Hab die antwort gefunden:

    $allowed_tags = [COLOR=#800000]'<img>,<small>,<strong>,<em>,<b>,<i>,<p>,<br>,<a>,<blockquote>,<ul>,<li>'[/COLOR]; [COLOR=#808080]/*** MODIFY THIS. Add the allowed HTML tags separated by a comma.***/[/COLOR]
    $twopart_tags = [COLOR=#800000]'<small>,<strong>,<em>,<b>,<i>,<p>,<br>,<a>,<blockquote>,<ul>,<li>'[/COLOR]; [COLOR=#808080]/*** MODIFY THIS. Add the twopart HTML tags separated by a comma.***/[/COLOR]
    [COLOR=#808080]/* turn tag list into one big search pattern */[/COLOR]
    $search_patterns = [COLOR=#800000]"/"[/COLOR] . str_replace([COLOR=#800000]","[/COLOR],[COLOR=#800000]"|"[/COLOR],str_replace([COLOR=#800000]">"[/COLOR], [COLOR=#800000]"[^>]*>"[/COLOR],$twopart_tags)) . [COLOR=#800000]'/'[/COLOR];

    $text = strip_tags($text, $allowed_tags);

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!