admin管理员组文章数量:1278918
I have a website with several custom fields, however when using the following code to search for a post, it only searches for the title or for the content, excluding the custom fields associated with the post or entry.
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" placeholder="<?php esc_attr_e( 'Buscar por título, actor, año...', 'twentyeleven' ); ?>" />
<input type="submit" class="submit" name="submit" id="boton" value="" />
</form>
any way to include custom fields in the search?
I have a website with several custom fields, however when using the following code to search for a post, it only searches for the title or for the content, excluding the custom fields associated with the post or entry.
<form method="get" id="searchform" action="<?php bloginfo('url'); ?>/">
<input type="text" value="<?php the_search_query(); ?>" name="s" id="s" placeholder="<?php esc_attr_e( 'Buscar por título, actor, año...', 'twentyeleven' ); ?>" />
<input type="submit" class="submit" name="submit" id="boton" value="" />
</form>
any way to include custom fields in the search?
Share Improve this question asked Oct 3, 2021 at 6:08 juanjuan 12 bronze badges2 Answers
Reset to default 0you can create your own search creating a file called search.php in your theme, there you can customize your search however you want.
probably you already have a way to call it, however you can call it with
get_search_form();
Tiago's answer will work if you wanna get coding. This plugin does exactly what you want in case you don't mind adding a new plugin to your install.
https://www.relevanssi
本文标签: phpInclude custom fields in search
版权声明:本文标题:php - Include custom fields in search 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741281446a2370031.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论