【问题标题】:Wordpress theme fails to load, /js/jquery.php?Wordpress 主题无法加载,/js/jquery.php?
【发布时间】:2014-02-03 06:40:55
【问题描述】:
Warning: require_once(/js/jquery.php): failed to open stream: No such file or directory in /home1/jamie/public_html/drexelreviews.com/wp-content/themes/instant/functions.php on line 494

Fatal error: require_once(): Failed opening required '/js/jquery.php' (include_path='.:/opt/php54/lib/php') in /home1/jamie/public_html/drexelreviews.com/wp-content/themes/instant/functions.php on line 494

我打开 jquery.php 文件是空白的,

我不确定这是从哪里来的 /opt/php54/lib/php 我在 hostgator 中运行 wordpress 3.8.1...有什么建议吗?

【问题讨论】:

  • 试过 $_SERVER['DOCUMENT_ROOT'];?

标签: php jquery wordpress wordpress-theming web-hosting


【解决方案1】:

如果这是您的动态 js 文件,您仍然需要将其排入队列。functions.php 中的代码可以是这样的...

function my_scripts_method() {
  wp_enqueue_script(
  'custom-script',
  get_stylesheet_directory_uri() . '/js/jquery.php',
  array( 'jquery' )
  );
}
add_action( 'wp_enqueue_scripts', 'my_scripts_method' );

【讨论】:

    【解决方案2】:

    您在 WordPress 模板文件中..
    尝试拨打get_template_part('js/jquery');

    【讨论】:

      【解决方案3】:

      包含文件的位置尝试提供完整路径

      <?php  bloginfo('template_directory'); ?>/js/jquery.php
      

      【讨论】:

        【解决方案4】:

        假设您正在使用类似的东西来要求文件

        <?php require_once ('/js/jquery.php');?>
        

        Wordpress 将需要来自根目录的文件。所以在这种情况下没有这样的文件。

        如果您需要主题文件夹中的文件“例如 foobar-theme”,则需要 as

        &lt;?php require_once (get_template_directory_uri().'/js/jquery.php');?>

        最后注意检查您是否在 jquery.php 之上设置了正确的 Mime 类型(假设您的要求是运行 js 代码)

        内容类型:应用程序/javascript

        【讨论】:

          猜你喜欢
          • 2016-11-24
          • 1970-01-01
          • 2017-11-18
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2020-09-13
          • 1970-01-01
          • 1970-01-01
          相关资源
          最近更新 更多