【问题标题】:WordPress Search results ProgrammaticallyWordPress 以编程方式搜索结果
【发布时间】:2015-02-16 17:32:53
【问题描述】:

我想根据用户输入的 url 在我的 404 页面上包含自动搜索结果输出。

问题在于,在通常的 search.php 文件中,wordpress 从 URL 参数中获取值并使用常规循环,如下所示:

 <?php while (have_posts()) : the_post(); ?>
   <h1>Search Results</h1>
   <a href="<?php the_permalink() ?>"> <h2><?php the_title(); ?></h2> </a>
 <?php endwhile; ?>

如何获取它以便我可以在代码中手动输入搜索词?

非常感谢。

【问题讨论】:

标签: php wordpress loops search


【解决方案1】:

您想使用 url 中的值自动搜索吗? 也许您可以使用该值显示您的类似帖子,或者使用搜索您的网站和 google.com 向他们显示带有搜索表单的最近帖子。 可能这个链接可以帮助Built Effective 404 Error Pages

希望对你有所帮助,

【讨论】:

    猜你喜欢
    • 2010-11-26
    • 2016-02-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-10-08
    • 1970-01-01
    相关资源
    最近更新 更多