简体   繁体   English

Algolia搜索不适用于WordPress中的Genesis主题

[英]Algolia Search Not working with Genesis theme in WordPress

I am trying to get Algolia Search to work on Genesis child theme. 我正在尝试让Algolia Search从事Genesis儿童主题的研究。

I have downloaded the Beta WordPress plugin from https://github.com/algolia/algoliasearch-wordpress . 我已经从https://github.com/algolia/algoliasearch-wordpress下载了Beta WordPress插件。 While I can see that network wise, everything works well, the Search Results do not show up in the AJAX drop down just below the Search Box. 虽然我可以看到网络方面的知识,但一切正常,但搜索结果并未显示在“搜索框”下方的AJAX下拉列表中。

Another interesting observation is that while the main Search Bar on the front end of the website does not show any results, the small Search bar within the Admin menu on the top right corner of the page does show the results. 另一个有趣的观察结果是,虽然网站前端的主搜索栏没有显示任何结果,但页面右上角的管理菜单中的小搜索栏却显示了结果。 That is because the Algolia code attaches to any DOM element with [name="s"]. 这是因为Algolia代码使用[name =“ s”]附加到任何DOM元素。

However, I have checked using the Inspect tools that the Main Search bar is also surrounded by Algolia <span class> . 但是,我已经使用检查工具检查了主搜索栏是否也被Algolia <span class>包围。 As I type into the Main Search Bar, I can see the DOM changing dynamically to add the <div> tags containing the search results. 在主搜索栏中键入内容时,我可以看到DOM动态变化以添加包含搜索结果的<div>标签。 So I know that the network piece is working. 因此,我知道网络部分正在运行。

Any ideas or suggestions on what to try? 关于尝试什么的任何想法或建议?

Other things I have tried: 我尝试过的其他方法:

  1. I placed the Search bar in the footer as well (thinking that maybe the opacity might be a problem in the header). 我也将搜索栏放在页脚中(认为不透明可能是页眉中的问题)。 Same result 结果相同
  2. I have tested the same plugin on a similar site (with identical plugins) but with a non-Genesis theme. 我已经在相似的网站上测试了相同的插件(具有相同的插件),但是主题不是Genesis。 It works fine. 工作正常。 That is why I have concluded that this might be related to Genesis. 这就是为什么我得出结论,这可能与创世纪有关。
  3. As I stated above, when I type in the Search bar in the top right corner within the WordPress Admin menu, it does work. 如上所述,当我在WordPress管理员菜单的右上角输入搜索栏时,它确实可以工作。

For anyone else that is trying to get this to work on genesis, here is the CSS change: The issue is that the parent .search-form is configured with a weird "overflow: hidden". 对于试图使之在创世上起作用的其他人,这是CSS更改:问题是,父.search-form配置了一个奇怪的“溢出:隐藏”。 To fix your theme, just add the following CSS rule: 要修复您的主题,只需添加以下CSS规则:

.search-form {
overflow: visible !important;
}

A new version of the plugin was released recently, 0.2.6 at the time of writing this. 该插件的新版本最近发布,在撰写本文时为0.2.6。

In the new version, the dropdown is no longer injected in the same container as the search input container but is attached to the document instead. 在新版本中,该下拉列表不再与搜索输入容器注入同一容器中,而是附加到文档中。

You should no longer need to tweak the CSS like it is shared in your own answer. 您不再需要调整CSS,就像在您自己的答案中共享它一样。

You can download the latest version from: https://community.algolia.com/wordpress 您可以从以下网址下载最新版本: https//community.algolia.com/wordpress

Best 最好

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM