admin管理员组文章数量:1130349
I want to make a search page, offering search functionalities by: 1) word 2) tag 3) category 4) author Can you recommend any technique, any guideline as per how to tackle this?
I want to make a search page, offering search functionalities by: 1) word 2) tag 3) category 4) author Can you recommend any technique, any guideline as per how to tackle this?
Share Improve this question asked Jul 19, 2012 at 12:48 p.a.p.a. 5813 gold badges13 silver badges29 bronze badges2 Answers
Reset to default 3You'll want to add some radio buttons inside your search form. Then add a filter to your search:
function filter_search( $query ) {
if( $query->is_search ) {
if ( isset($_GET['tag']) )
// alter your search query here.
}
return $query;
}
add_filter( 'pre_get_posts' , 'filter_search' );
Influenced by http://wordpress/support/topic/how-to-add-search-filter-by-custom-values#post-1463329
If you'd prefer to let a WordPress plugin handle the work for you, check out Search Everything, in the WordPress plugin repository.
Increases WordPress' default search functionality in three easy steps using Search Everything.
Better WordPress search in three steps
Activate Configure options Search ( maybe that's only two steps )
Options include search highlight, searching pages, excerpts, attachments, drafts, comments and custom fields (metadata).
What it does:
Search Everything increases the ability of the default WordPress Search, options included:
- Search Highlighting
- Search Every Page
- Search Every Tag
- Search Custom Taxonomies ( new )
- Search Every Category
- Search non-password protected pages only
- Search Every Comment
- Search only approved comments
- Search Every Draft
- Search Every Excerpt
- Search Every Attachment (post type)
- Search Every Custom Field (metadata)
- Exclude Posts from search
- Exclude Categories from search
[WordPress Plugin]: Search Everything
I want to make a search page, offering search functionalities by: 1) word 2) tag 3) category 4) author Can you recommend any technique, any guideline as per how to tackle this?
I want to make a search page, offering search functionalities by: 1) word 2) tag 3) category 4) author Can you recommend any technique, any guideline as per how to tackle this?
Share Improve this question asked Jul 19, 2012 at 12:48 p.a.p.a. 5813 gold badges13 silver badges29 bronze badges2 Answers
Reset to default 3You'll want to add some radio buttons inside your search form. Then add a filter to your search:
function filter_search( $query ) {
if( $query->is_search ) {
if ( isset($_GET['tag']) )
// alter your search query here.
}
return $query;
}
add_filter( 'pre_get_posts' , 'filter_search' );
Influenced by http://wordpress/support/topic/how-to-add-search-filter-by-custom-values#post-1463329
If you'd prefer to let a WordPress plugin handle the work for you, check out Search Everything, in the WordPress plugin repository.
Increases WordPress' default search functionality in three easy steps using Search Everything.
Better WordPress search in three steps
Activate Configure options Search ( maybe that's only two steps )
Options include search highlight, searching pages, excerpts, attachments, drafts, comments and custom fields (metadata).
What it does:
Search Everything increases the ability of the default WordPress Search, options included:
- Search Highlighting
- Search Every Page
- Search Every Tag
- Search Custom Taxonomies ( new )
- Search Every Category
- Search non-password protected pages only
- Search Every Comment
- Search only approved comments
- Search Every Draft
- Search Every Excerpt
- Search Every Attachment (post type)
- Search Every Custom Field (metadata)
- Exclude Posts from search
- Exclude Categories from search
[WordPress Plugin]: Search Everything
本文标签: categoriesSearch by wordcategorytagauthor
版权声明:本文标题:categories - Search by word, category, tag, author 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:https://it.en369.cn/questions/1749039937a2306974.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。


发表评论