WordPress和jQuery [英] Wordpress and jquery

查看:78
本文介绍了WordPress和jQuery的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从来没有对wordpress感到太多困惑,并且真的很困惑.我正在尝试通过jquery添加视频播放列表/画廊.不是wordpress插件.我什至不确定自己在做什么错,希望有人可以帮助我解决这个问题.该站点位于 http://okaysewwhat.com/,它现在只是一个骨架,因为它尚不可用. 我正在使用的jquery插件是这个 http://www.geckonewmedia.com/blog/2009/8/14/jquery-youtube-playlist-plugin---youtubeplaylist

I have never messed with wordpress much and am real stuck. I am trying to add a video playlist/gallery via jquery. Not a wordpress plugin. I am not even sure what I am doing wrong and am hoping someone could help me through it please. The site is here, http://okaysewwhat.com/ it is just a skeleton now since this does not work yet. The jquery plugin I am using is this, http://www.geckonewmedia.com/blog/2009/8/14/jquery-youtube-playlist-plugin---youtubeplaylist

好吧,所以我在wordpress的header.php中,添加了它以调用youtube部分的样式表

Ok so I have inside the header.php of wordpress, added this to call the stylesheet for the youtube part,

<link rel="stylesheet" type="text/css" media="all" href="<?phpbloginfo('stylesheet_url'); ?>/youtube.css" />

然后是这部分,您可以看到我添加的内容,

then after that is this part, you can see what I added,

    <?php


        wp_enqueue_script("jquery");

        if ( is_singular() ) wp_enqueue_script( 'comment-reply' );



        wp_head(); 

        global $options;
        foreach ($options as $value) {
             if (get_settings( $value['id'] ) === FALSE) { $$value['id'] = $value['std']; } else { $$value['id'] = get_settings( $value['id'] ); }
        }
    ?>

<script src="<?php bloginfo('template_directory'); ?>/jquery.youtubeplaylist.js" type="text/javascript" charset="utf-8"></script>


<script type="text/ecmascript">
jQuery.noConflict();

    $(function() {
        $("ul.demo2").ytplaylist({addThumbs:true, autoPlay: false, holderId: 'ytvideo2'});
    });

</script>

我在wordpress main_col div下面添加的index.php里面,

Inside index.php I added, right under the wordpress main_col div,

<?php include (TEMPLATEPATH . '/tube.php'); ?> 

tube.php中的所有内容都是vids列表,

and all that is in tube.php is the list of vids,

<code>
    <div class="yt_holder">
    <div id="ytvideo2"></div>
    <ul class="demo2">
        <li><a href="http://www.youtube.com/watch?v=QBBWKvY-VDc">Video 1</a></li>
        <li><a href="http://www.youtube.com/watch?v=ZXMQqLnRhRI">Video 2</a></li>
        <li><a href="http://www.youtube.com/watch?v=Wvo-g_JvURI">Video 3</a></li>
    </ul>
</div>
</code>

我希望这不要太费解了,我对此表示歉意,我对此感到非常迷lost,以至于不再理解.显示的只是一个列表,就像您从上面的ul中获得的一样.
而且萤火虫给了我错误

I hope this is not too convoluded, I aploogize, I am just so lost in this I do not understand it anymore. All that displays is a list like you would get from the ul above.
And firebug gives me the error

Firebug's log limit has been reached. %S entries not shown.     Preferences  
$ is not a function
okaysewwhat.com()okaysewwhat.com (line 40)
[Break on this error] $(function() {\n

我也不知道.谢谢您提供的所有提示.

which I dont get either. I would appreciate any tips guys, thank you so much.

推荐答案

http://docs .jquery.com/Core/jQuery.noConflict

使用此功能,您将只能使用'jQuery'变量访问jQuery.例如,您以前曾经做过$("div p"),现在必须做jQuery("div p").

By using this function, you will only be able to access jQuery using the 'jQuery' variable. For example, where you used to do $("div p"), you now must do jQuery("div p").

这篇关于WordPress和jQuery的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆