【问题标题】:prettyPhoto not working in my wordpress themeprettyPhoto 在我的 wordpress 主题中不起作用
【发布时间】:2012-10-20 04:48:20
【问题描述】:

所以朋友们,我正在尝试在我的 wordpress 主题中使用 prettyPhoto,但它根本不起作用。它的两个文件 - prettyPhoto.css 和 jquery.prettyPhoto.js 都在 header.php 文件中正确链接。

这是我的 header.php 文件中文件的链接 -

<link rel="stylesheet" href="<?php bloginfo('stylesheet_directory'); ?>/js/prettyPhoto/css/prettyPhoto.css" type="text/css" media="screen" title="prettyPhoto main stylesheet" charset="utf-8" />
<script src="<?php bloginfo('stylesheet_directory'); ?>/js/prettyPhoto/js/jquery.prettyPhoto.js" type="text/javascript"></script>

如果这个问题是由于没有使用 wp_enqueue_script() 造成的,请告诉我。

这就是我如何链接要与 prettyPhoto 一起使用的图像 -

<a title="test image" href="images/new-image.png" rel="prettyPhoto[]"><img src="images/new-image.png" alt="Some Alternate Text" /></a>

当我点击图片时,它不会在 prettyPhoto 中打开。

【问题讨论】:

    标签: php jquery css wordpress


    【解决方案1】:

    您是否构建了自定义主题以使其正常工作。如果是这样,可能存在对 header.php index.php 或 footer.php 等文件的其他依赖项,这可能导致它无法工作。切换到默认的 21 主题,看看效果如何。如果它在那里工作,那么你的主题文件有问题,可能是 footer.php 或 index.php 等。

    【讨论】:

    • 如果我必须将代码放在编辑器中,footer.php 或 index.php 文件可能有什么问题?一件事,我已经把 prettyPhoto 的附加代码放在 header.php 文件中......
    • 您是否尝试为二十一个主题启用漂亮照片
    • 好的,好的,抱歉......我的问题是文件链接,我在 jquer.js 之前添加了 jquery.prettyPhoto.js 所以它不起作用......现在它正在工作,你们所有人需要在 jquery 库之后添加 jquery.prettyPhoto.js。
    猜你喜欢
    • 2018-01-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-06-23
    • 1970-01-01
    • 2018-09-17
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多