Twig highlight word (Timber plugin)
问题 I use Timber plugin for Wordpress. And I create a results search page. I would like to highlight the word that the user searched. In PHP I wrote that : $highlight = array(); if ($terms) { foreach($terms as $term) { array_push($highlight, '<span class="blue bold">'.$term.'</span>'); } } And that, to replace the searched word in PHP : <p class="date red"><?php echo str_ireplace($terms, $highlight, get_field('subtitle_post')); ?></p But I don't know how to transform that in Twig (Timber) ? 回答1: