当前位置: 首页技术教程 ripro主题首页搜索框,输入关键字后,最多会弹出5个相关的结果。有的喜欢多显示几个,那么要怎么修改呢? 其实很简单 修改目录ripro/inc/core-ajax.php 84行,下列代码修改弹出8个相关结果~~ 好了教程就到这里,根据自己的喜好修改吧 function ajax_search() { global $wp_query; header('Content-type:application/json; Charset=utf-8'); $text = !empty($_POST['text']) ? esc_sql($_POST['text']) : null; $args = array('s' => $text,'posts_per_page' => 8); $array_posts = array (); $data = new WP_Query($args); while ( $data->have_posts() ) : $data->the_post(); array_push($array_posts, array("title"=>get_the_title(),"url"=>get_permalink(),"img"=>_get_post_timthumb_src() )); endwhile; echo json_encode($array_posts); exit(); } 声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。 设计酷永久VIP 收藏 海报分享