最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Search within the current page

programmeradmin4浏览0评论

I'm trying to place a second search bar, along with the main navigation search bar, on a specific page within a site so that I can search just within that page. Per the recommendation of someone, I placed the following code in my functions.php file

add_shortcode( 'search', 'tu_search_shortcode' ); function tu_search_shortcode() { ob_start(); get_search_form(); $ret = ob_get_contents(); ob_end_clean(); return $ret; }

and then added the shortcode [search] to the page.

That worked for putting the search bar on that page where I wanted it, but it still searches the entire site like the general search bar does.

Does anyone know if I can limit the search to that specific page?

与本文相关的文章

发布评论

评论列表(0)

  1. 暂无评论