i am missing some details but here is the code for this string
"category level 1-> level 2 -> level3"...
我还将搜索词作为标题和围绕它的循环。。
<h1><?php echo \'Search Results For:\'. get_search_query(); ?></h1>
<ul>
<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
<?php
$category = get_the_category();
$catName = $category[0]->cat_name;
$catFatherID = $category[0]->category_parent;
$catFather = get_the_category_by_ID($catFatherID)
?>
<li class="result"><?php if($catFather){echo $catFather.\'»\';}; echo $catName.\'»\';the_title(); ?></li>
<?php endwhile; ?>
<?php endif; ?>
</ul>
。
希望这有帮助;)<干杯,萨吉夫。