简体   繁体   English

如何使自定义UI组件与自定义Wordpress主题一起正常工作?

[英]How do I get my custom UI component to work correctly with my custom Wordpress theme?

I'm making a couple of themes for Wordpress from scratch. 我正在从零开始为Wordpress制作几个主题。 Everything seems to work alright, but when i installed thethe tabs and accordions plugin, a plugin for making accordions with jQuery i realized that jQuery is not working with my templates! 一切似乎都正常,但是当我安装了tabs and Accordions插件时,这是一个用jQuery制作手风琴的插件,我意识到jQuery无法使用我的模板! I searched a lot, but every method that i try to implement is not working: 我进行了很多搜索,但是尝试执行的每种方法均无效:

<?php wp_enqueue_script("jquery"); ?> //Not working
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js" type="text/javascript"></script>
<?php wp_head(); ?> // Not working
<script type="text/javascript" src="<?php bloginfo('template_directory'); ?>/js/jquery-1.4.2.min.js"></script> //Not working

I even try to make a function in the functions.php file, but i got the same results. 我什至尝试在functions.php文件中创建一个函数,但结果却相同。 When i look at the code with Chrome it looks like the site is loading jQuery, but for some reason my accordion plugin is not working. 当我用Chrome浏览器查看代码时,该网站似乎正在加载jQuery,但由于某种原因,我的手风琴插件无法正常工作。 I'm not very familiar with jQuery and Javascript. 我对jQuery和Javascript不太熟悉。

I'm working on a localhost and i tried with tewnty eleven and twenty ten themes and everything works well with them. 我在本地主机上工作,尝试了11个和20个主题,并且一切工作正常。 For some reason my themes are not working properly. 由于某些原因,我的主题无法正常工作。

Any help would be welcomed. 任何帮助都将受到欢迎。

Updated on 04/01/2012 于04/01/2012更新

After trying everything! 尝试一切之后! I decided to take another way. 我决定采取另一种方式。 I used the Shape theme from Thematic, copy all my content over the original content and, voila! 我使用了Thematic的Shape主题,将我的所有内容复制到原始内容上,瞧! Everything it's working properly! 一切工作正常! I really don't understand why, but at least it worked. 我真的不明白为什么,但是至少能奏效。 It's very strange because when i follow the tutorial from Thematic to make a theme like Shape the problem appears again... so, if somebody is getting problems to get jQuery plugins working properly on a WP Theme from scratch i recommend to use the Shape theme as a base theme for start working on. 这很奇怪,因为当我按照Thematic的教程制作一个类似Shape的主题时,问题再次出现...因此,如果有人遇到问题,使jQuery插件从零开始在WP主题上正常工作,我建议使用Shape主题作为开始工作的基本主题。 Hope it helps somebody! 希望对您有所帮助!

It seems like your trying to include multiple versions of jquery, is that needed? 似乎您尝试包含多个版本的jquery,这是否需要? Also I always put wp_head last. 我也总是把wp_head放在最后。 Lastly, and only because I do this all the time, are your files named correctly and in the right folders? 最后,仅由于我一直这样做,您的文件是否正确命名并位于正确的文件夹中?

暂无
暂无

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

相关问题 如何在我的 wordpress 主题 (Understrap) 中实现自定义 JS? - How do I implement custom JS into my wordpress theme (Understrap)? Angular.js-如何将自定义过滤器正确输出到dom - Angularjs - How do I output my custom filters to the dom correctly 如何通过使用 Material UI 的组件库正确使用自定义主题(我不想用它们包装所有组件) - How to use custom theme correctly with component lib that uses Material UI (I don't want to wrap with them all components) 如何将animejs导入我的wordpress主题? - How do I import animejs into my wordpress theme? 如何在“ Algolia搜索”页面结果的摘录中显示我的Wordpress自定义字段属性? - How do I display my Wordpress custom field attribute in the excerpt of my Algolia Search page results? 如何将自定义搜索组件嵌套在主面板中? - How do I nest my custom search component inside my home panel? Wordpress 导航栏,我对 java 脚本有疑问,因为我必须设置自己的导航栏,因为它是自定义主题 - Wordpress navbar, i have a problem with java script, because i had to style my own navbar, as it is custom theme 插件 Javascript(可能是 ajax)在我的 wordpress 自定义主题中不起作用 - Plugin Javascript(maybe ajax) is not working in my wordpress custom theme 防止我的自定义WordPress主题被复制 - Keeping my custom WordPress theme from being copied 如何修改我的自定义输入组件以使用 vee-validate? - How to modify my custom input component to work with vee-validate?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM