解决WordPress 知更鸟begin主题搜索不显示的问题!

  • A+
所属分类:电脑技巧

 

解决WordPress 知更鸟begin主题搜索不显示的问题!

首先解决在WordPress5.2版本时知更鸟lts主题搜索不显示的问题:

 

具体原因可能是WordPress代码改变了。

解决办法是吧主题根目录的searchform.php修改下就能正常使用。

原代码:

  1. <div class="searchbar">
  2. <form method="get" id="searchform" action="<?php echo esc_url( home_url() ); ?>/">
  3. <span class="search-input">
  4. <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" placeholder="<?php _e( '输入搜索内容', 'begin' ); ?>" required />
  5. <button type="submit" id="searchsubmit"><i class="be be-search"></i></button>
  6. </span>
  7. <?php if (zm_get_option('search_cat')) { ?>
  8. <span class="search-cat">
  9. <?php $args = array(
  10. 'show_option_all' => '全部分类',
  11. 'hide_empty' => 0,
  12. 'name' => 'cat',
  13. 'show_count' => 0,
  14. 'taxonomy' => 'category',
  15. 'hierarchical' => 1,
  16. 'depth' => -1,
  17. 'exclude' => zm_get_option('not_search_cat'),
  18. ); ?>
  19. <?php wp_dropdown_categories( $args ); ?>
  20. </span>
  21. <?php } ?>
  22. </form>
  23. </div>

 

变更后:

  1. <div class="searchbar">
  2. <form method="get" id="searchform" action="<?php echo esc_url( home_url() ); ?>/">
  3. <span class="search-input">
  4. <input type="text" value="<?php the_search_query(); ?>" name="s" id="s" placeholder="<?php _e( '输入搜索内容', 'begin' ); ?>" required />
  5. <button type="submit" id="searchsubmit"><i class="be be-search"></i></button>
  6. </span>
  7. <?php if (zm_get_option('search_option') == 'search_cat') { ?><?php search_cat_args( ); ?><?php } ?>
  8. </form>
  9. </div>

效果如下完美:

 

解决WordPress 知更鸟begin主题搜索不显示的问题!解决WordPress 知更鸟begin主题搜索不显示的问题!

 

学习资料见知识星球。

以上就是今天要分享的技巧,你学会了吗?若有什么问题,欢迎在下方留言。

快来试试吧,小琥 my21ke007。获取 1000个免费 Excel模板福利​​​​!

更多技巧, www.excelbook.cn

欢迎 加入 零售创新 知识星球,知识星球主要以数据分析、报告分享、数据工具讨论为主;

解决WordPress 知更鸟begin主题搜索不显示的问题!

你将获得:

1、价值上万元的专业的PPT报告模板。

2、专业案例分析和解读笔记。

3、实用的Excel、Word、PPT技巧。

4、VIP讨论群,共享资源。

5、优惠的会员商品。

6、一次付费只需99元,即可下载本站文章涉及的文件和软件。

  • 我的微信
  • weinxin
  • 我的知识星球
  • weinxin

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: