Support » Allgemeine Fragen » add_filter in functions.php (childtheme/thematic)

  • Hallo, ich sitze nun schon seit Stunden vor einem Problem mit einer Funktion die ich benutzen möchte. Normalerweise finde ich zu allen Problemen Hilfe in den diversen Foren, nur heute nicht… 🙁

    Folgendes Problem: Ich möchte mittels einer eigenen Funktion aus dem Content die blockquote tags ausfiltern und durch Images ersetzen. Funktioniert auch soweit, aber die paragraphs sowie weitere tags werden danach nicht mehr ausgegeben.

    Wer kann mir helfen? Ich habe was gelesen mit apply_filters(…), komme aber damit nicht weiter…

    Hier mein Code:

    <?php
    function blockquote($blockquote_content) {
        $quote_start = '<img class="quote_start" src="images/quote_start.png" width="54" height="54" alt="" title="" /><div class="quote_content">';
        $quote_end = '</div><img class="quote_end" src="images/quote_end.png" width="54" height="54" alt="" title="" />';
    
        $blockquote_content = get_page();
        $blockquote_content = $blockquote_content->post_content;
    
        $blockquote_content = str_replace('<blockquote>"','<blockquote>'.$quote_start,$blockquote_content);
        $blockquote_content = str_replace('"</blockquote>',''.$quote_end.'</blockquote>',$blockquote_content);
    
        $blockquote_content = apply_filters('get_the_content',$blockquote_content);
    
        return $blockquote_content;
    }
    add_filter('the_content', 'blockquote');
    ?>
Ansicht von 1 Antwort (von insgesamt 1)
Ansicht von 1 Antwort (von insgesamt 1)
  • Das Thema „add_filter in functions.php (childtheme/thematic)“ ist für neue Antworten geschlossen.