0
A
回答
0
创建一个search.php并以此代码为例。
<?php get_header(); ?>
<div id="content">
<?php if (have_posts()) : ?>
\t <h1>Search Result for <?php /* Search Count */ $allsearch = &new WP_Query("s=$s&showposts=-1"); $key = wp_specialchars($s, 1); $count = $allsearch->post_count; _e(''); _e('<span class="search-terms">'); echo $key; _e('</span>'); _e(' — '); echo $count . ' '; _e('acapellas'); wp_reset_query(); ?></h1>
\t <ul>
\t <?php while (have_posts()) : the_post(); ?>
\t \t <li>
\t \t \t <h2><?php the_title(); ?></h2>
\t \t \t <p><?php the_excerpt(); ?></p>
\t \t </li>
\t <?php endwhile; endif; ?>
\t </ul>
</div>
<?php get_footer(); ?>
确保您searchform.php与WordPress的标准,下面有一个例子规定。
<form method="get" class="search-form" action="<?php echo home_url('/'); ?>">
<label>
<span class="screen-reader-text"><?php echo _x('Search:', 'label') ?></span>
<span>Search</span>
<input type="search" class="search-field" placeholder="Search" value="<?php echo get_search_query() ?>" name="s" title="<?php echo esc_attr_x('Search:', 'label') ?>" />
</label>
<button type="submit" class="search-submit" value="<?php echo esc_attr_x('Search', 'submit button') ?>">
</button>
</form>
相关问题
- 1. 搜索结果不显示在WordPress中的多个词搜索
- 2. 如何显示Wordpress搜索结果?
- 3. Wordpress搜索没有显示结果
- 4. 搜索结果不显示
- 5. WordPress的搜索结果显示结果是断开的链接
- 6. 显示搜索结果API
- 7. 搜索和显示结果
- 8. 显示搜索结果
- 9. 显示搜索结果
- 10. 显示搜索结果
- 11. 显示搜索结果
- 12. 搜索结果显示
- 13. 搜索结果(显示更多结果)
- 14. WordPress的Live搜索不显示任何结果
- 15. Wordpress搜索表单不显示结果,因为它应该是
- 16. 搜索栏和搜索显示控制器搜索后不显示结果
- 17. PHP Live搜索不显示结果
- 18. UISearchBar - 搜索结果不显示
- 19. phrets不显示搜索结果
- 20. JQuery TokenInput不显示搜索结果
- 21. 反应:搜索结果不显示?
- 22. PHP搜索功能不显示结果
- 23. 选择不显示搜索结果
- 24. 搜索按钮不显示结果
- 25. (Haystack,Woosh,Django)搜索结果不显示
- 26. 搜索功能不显示结果。
- 27. 搜索结果不会显示
- 28. 搜索结果不会自动显示
- 29. elasticlunr.js不显示搜索查询结果
- 30. magento搜索结果不显示
WordPress搜索表单在您的主题文件夹中调用search.php。这个文件里有什么? – aletede91