wordpress搜索结果页面上的添加按钮

wordpress搜索结果页面上的添加按钮,wordpress,search,wordpress-theming,customization,custom-wordpress-pages,Wordpress,Search,Wordpress Theming,Customization,Custom Wordpress Pages,我想在搜索结果框中添加一个按钮“找不到运动鞋?单击此处”。此按钮将用作指向另一个页面的链接,客户可以在该页面上提交自定义订单。请告诉我在哪里必须为此按钮编码 我尝试在search.php中添加按钮代码,但按钮并没有出现在搜索结果页面中 " 假设您使用的是默认WordPress搜索页面,您可以通过全局wp_查询访问结果数量 global $wp_query; $customOrderPageId = 10; // UPDATE with your custom order page ID $s

我想在搜索结果框中添加一个按钮“找不到运动鞋?单击此处”。此按钮将用作指向另一个页面的链接,客户可以在该页面上提交自定义订单。请告诉我在哪里必须为此按钮编码

我尝试在search.php中添加按钮代码,但按钮并没有出现在搜索结果页面中

"



假设您使用的是默认WordPress搜索页面,您可以通过全局wp_查询访问结果数量

global $wp_query;

$customOrderPageId = 10; // UPDATE with your custom order page ID
$searchTerm = get_search_query() // If you want a flexible "Desired Sneakers" based on what the user is searching...

if ($wp_query->found_posts == 0) {
 echo '<a class="btn" href="'.get_permalink($customOrderPageId).'">Not found '.$searchTerm.'? Click here</a>';
}
global$wp\u查询;
$customOrderPageId=10;//使用自定义订单页面ID更新
$searchTerm=get\u search\u query()//如果您希望根据用户正在搜索的内容提供灵活的“所需运动鞋”。。。
如果($wp\u query->found\u posts==0){
回声';
}

共享您的代码欢迎使用Stack Overflow。请注意,由于这不是免费的代码编写服务,因此有必要显示您迄今为止尝试过的内容以及遇到的问题或错误(通过显示代码)或者至少展示一下你所做的研究和努力。否则,这只是要求我们为你做所有的工作。阅读并可能帮助你改进你的问题。祝你好运!我已经添加了代码,请现在帮助我
global $wp_query;

$customOrderPageId = 10; // UPDATE with your custom order page ID
$searchTerm = get_search_query() // If you want a flexible "Desired Sneakers" based on what the user is searching...

if ($wp_query->found_posts == 0) {
 echo '<a class="btn" href="'.get_permalink($customOrderPageId).'">Not found '.$searchTerm.'? Click here</a>';
}