1
我使用WordPress的木材插件。樹枝突出顯示詞(木材插件)
我創建了一個結果搜索頁面。我想突出顯示用戶搜索的字詞。
在PHP中我寫道:
$highlight = array();
if ($terms) {
foreach($terms as $term) {
array_push($highlight, '<span class="blue bold">'.$term.'</span>');
}
}
而這,更換搜索詞中的PHP:
<p class="date red"><?php echo str_ireplace($terms, $highlight, get_field('subtitle_post')); ?></p
但我不知道如何變換,在嫩枝(木材) ?