gpt4 book ai didi

php - Wordpress:在表中搜索元素

转载 作者:太空狗 更新时间:2023-10-29 16:40:36 25 4
gpt4 key购买 nike

我创建了一个测试页面,用户可以在其中访问 pdf 和 word 文档。

网站:http://recordandreturn2.insctest1.com/online-forms

wordpress 网站上的默认搜索功能不会在您输入任何元素后显示它们。例如,搜索“继承权宣誓书”。我正在使用一个名为 easy table 的插件,因为客户端将需要轻松添加或删除向前移动的元素。我搜索了 wordpress 搜索功能增强器,但似乎没有任何效果。

这个示例站点有一个可以显示表单的搜索功能,这是我想要实现的:http://www.judicialtitle.com/resources/forms

最佳答案

这是一个能够搜索简码的插件: https://wordpress.org/plugins/wp-ultimate-search/

或者,您可以将以下内容添加到 functions.php 以在搜索中包含短代码

<?php
//Replace wp_trim_excerpt with a commented out strip_shortcodes()
function improved_trim_excerpt($text) {
$raw_excerpt = $text;
if ( '' == $text ) {
$text = get_the_content('');

//$text = strip_shortcodes( $text );

$text = apply_filters('the_content', $text);
$text = str_replace(']]>', ']]>', $text);
$text = strip_tags($text);
$excerpt_length = apply_filters('excerpt_length', 55);
$excerpt_more = apply_filters('excerpt_more', ' ' . '[...]');
$words = preg_split("/[\n\r\t ]+/", $text, $excerpt_length + 1, PREG_SPLIT_NO_EMPTY);
if ( count($words) > $excerpt_length ) {
array_pop($words);
$text = implode(' ', $words);
$text = $text . $excerpt_more;
} else {
$text = implode(' ', $words);
}
}
return apply_filters('improved_trim_excerpt', $text, $raw_excerpt);
}

remove_filter('get_the_excerpt', 'wp_trim_excerpt');
add_filter('get_the_excerpt', 'improved_trim_excerpt');

//You might also need to add this in order to make sure the
//shortcodes are actually parsed and not just displayed
//$text = do_shortcode($text);
?>

此代码来自http://3rdplanetwebsolutions.com/news/add-shortcode-content-to-wordpress-search-results/

关于php - Wordpress:在表中搜索元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29854270/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com