Support » Plugin: Content Views - Post Grid & Filter for WordPress » How to str_replace text in excerpt of a view?

  • Resolved design_dolphin

    (@design_dolphin)


    Hi,

    Thank you for this plugin, enjoy it’s use very much, and like what you did with it.

    I’m trying to str_replace some text from the excerpt in a view using the WordPress filter, but the view seems to ignore the filter. Is it a seperate query? How do I interact with it?

    Regular way of changing text in WordPress excerpt example:

    function replace_excerpt_text($text) {
        $replace = array(
    // 'words to find' => 'replace with this'
            'text to replace' => 'replaced text'
        );
        $text = str_replace(array_keys($replace), $replace, $text);
        return $text;
    }
    
    add_filter('the_excerpt', 'replace_excerpt_text');
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.