本设置为适应网站导航,全局共用导航后导致其它文章类型搜索失败
网上找的代码在Tint中会导致搜索页导航无效,代码如下:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
function include_post_types_in_search($query) { if(is_search()) { $post_types = get_post_types(array('public' => true, 'exclude_from_search' => false), 'objects'); $searchable_types = array(); if($post_types) { foreach( $post_types as $type) { $searchable_types[] = $type->name; } } $query->set('post_type', $searchable_types); } return $query; } add_action('pre_get_posts', 'include_post_types_in_search'); |
如何在Tint主题中正常使用呢?
更改如下,首先
更改vm.Search.php
中
教程到此结束!
骗人啊,这付款看不到
我记得有修复会员缓存啊,看不到吗?
现在能看到了