搜索结果页面标题显示可见代码。
例如,这是搜索结果页面顶部显示的内容,包括搜索词周围的范围码:
"Search Results for: <span>search_word</span>"
我不知道span代码是在哪里生成的,需要帮助才能使代码不可见。我正在使用初级主题并查看与搜索相关的模板,但现在我被难住了。我将非常感谢你的帮助!非常感谢。
更新这里是奇怪的搜索。我在初级模板中找到的php代码-我切换到了2017主题,现在一切都好了:
<?php
/**
* The template for displaying search results pages.
*
* @link https://developer.wordpress.org/themes/basics/template-hierarchy/#search-result
*
* @package Primer
* @since 1.0.0
*/
get_header(); ?>
<section id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<?php if ( have_posts() ) : ?>
<?php while ( have_posts() ) : the_post() ?>
<?php get_template_part( \'content\', \'search\' ); ?>
<?php endwhile; ?>
<?php primer_pagination(); ?>
<?php else : ?>
<?php get_template_part( \'content\', \'none\' ); ?>
<?php endif; ?>
</main><!-- #main -->
</section><!-- #primary -->
<?php get_sidebar(); ?>
<?php get_sidebar( \'tertiary\' ); ?>
<?php get_footer(); ?>