【问题标题】:Insert jQuery and Twitter PHP code into WordPress将 jQuery 和 Twitter PHP 代码插入 WordPress
【发布时间】:2012-02-26 04:01:32
【问题描述】:

您好,我是新手,请多多包涵。我有一个 html 格式的免费主题,它上面有一个控制 twitter 的元素。我想将这种外观添加到我的 wordpress 博客的页脚。我已插入以下代码:

在functions.php中 !! wp_enqueue_script('inkthemes_tweet', get_stylesheet_directory_uri() . '/js/jquery.tweet.js', array('jquery'));

在footer.php中

<div class="twitter-head">
    <h1>Twitter</h1>
    <a class="readmore tw" href="#">Follow Me</a>
</div>
<div class="tweet"></div>

我在 js 目录中有实际的 jquery.tweet.js 文件

页脚上唯一显示的是 TWITTER & follow me

看来我还需要一些代码,在此先感谢

【问题讨论】:

    标签: php jquery wordpress


    【解决方案1】:

    好的,从你的 HTML 中删除所有内容,然后将其添加到头部:

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
        <script src="jquery.tweet.js"></script>
        <script>
            $(function() {
                $("#tweet").tweet({ user: "peteog" });
            });
        </script>
    

    将脚本 src 更改为您的 js 目录,将用户名更改为您的 twitter 用户名。

    然后将其添加到页脚:

    <div id="tweet"></div>
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-07-02
      • 2011-04-13
      • 2016-10-21
      • 2012-03-28
      • 1970-01-01
      • 2017-07-25
      • 2017-03-30
      相关资源
      最近更新 更多