代码适用于localhost,但不适用于服务器

时间:2016-12-20 05:11:42

标签: php server slider localhost flickity

我刚刚将我的客户网站启动到一个临时URL,这样他们就可以在完成CSS和完成工作时进行数据输入。然而,当我启动网站时,我发现它的一部分坏了,罪魁祸首是自定义帖子滑块。我不明白为什么它会破坏,因为它在我的本地主机上完全正常。

我正在使用名为Flickity的pkg,直到现在它一直很好。我在我的网站上使用其他Flickity滑块,所以我知道FLickity本身不是问题。我已在我的代码下面附加了滑块。

自定义帖子是剧院制作,并且应根据结束演出日期进行订购:ending_date [ACF]。

<section class="slider-prod">

    我们的制作

<div class="gallery js-flickity prod-slider" data-flickity-options='{"imagesLoaded": true, "selectedAttraction": 0.01, "friction": 0.3, "groupCells": 3, "cellAlign": "left", "contain": true, "pageDots": false }'>


<!-- CURRENT PRODUCTION -->       
    <?php // query posts
      $params = array(
        'post_type' => 'productions',
        'post' => $id,
        'posts_per_page' => -1,
        'meta_key' => 'ending_date',
        'orderby' => 'meta_value',
        'order' => 'ASC',
      );

      $slider_posts = new WP_Query($params);
    ?>

    <?php if ( $slider_posts->have_posts() ) while ( $slider_posts->have_posts() ) : $slider_posts->the_post(); ?>          

      <?php date_default_timezone_set('America/New_York'); 
        $slider_link = get_permalink();
        $starting_date = get_field('starting_date'); 
        $ending_date = get_field('ending_date'); 
        $location = get_field('location'); 
        $prod_link = get_permalink(); 
        $todays_date = date(Ymd); 
        ?>


      <?php if (($todays_date<=$ending_date) and ($todays_date>=$starting_date)): ?>   
        <div class="gallery-cell future-prod">
          <a href="<?php echo $slider_link; ?>" class="slider-link">            
            <?php the_post_thumbnail('hero'); ?>
            <div class="content">                
              <h3>            
                <?php the_title(); ?>
              </h3>
              <p>
              <?php 
                $end = date_create_from_format('Ymd',$ending_date);
                $start = date_create_from_format('Ymd',$starting_date);
                echo "<span class='month'>" . $start->format('F') . "</span>";
                echo " ";
                echo "<span class='day'>" . $start->format('j') . "</span>";
                echo ", ";
                echo "<span class='year'>" . $start->format('Y') . "</span>";

                echo " - ";

                echo "<span class='month'>" . $end->format('F') . "</span>";
                echo " ";
                echo "<span class='day'>" . $end->format('d') . "</span>";
                echo ", ";
                echo "<span class='year'>" . $end->format('Y') . "</span>";
                echo ", $location";
               ?> 
              </p>
              <p>              
                <?php echo wp_trim_words( get_the_content(), 40, '...' ); ?>
              </p>
              <h4 class="status now-playing">
                Now Playing
              </h4>
            </div>
          </a>
        </div> <!-- /.gallery-cell.future-pro -->
      <?php endif ?>

    <?php endwhile; ?>


<!-- FUTURE PRODUCTION -->       
    <?php // query posts
      $params = array(
        'post_type' => 'productions',
        'post' => $id,
        'posts_per_page' => -1,
        'meta_key' => 'ending_date',
        'orderby' => 'meta_value',
        'order' => 'DEC',
      );

      $slider_posts = new WP_Query($params);

      $array_rev = array_reverse($slider_posts->posts);
      //reassign the reversed posts array to the $home_shows object
      $slider_posts->posts = $array_rev;
    ?>

    <?php if ( $slider_posts->have_posts() ) while ( $slider_posts->have_posts() ) : $slider_posts->the_post(); ?>          

      <?php date_default_timezone_set('America/New_York'); 
        $slider_link = get_permalink();
        $starting_date = get_field('starting_date'); 
        $ending_date = get_field('ending_date'); 
        $location = get_field('location'); 
        $prod_link = get_permalink(); 
        $todays_date = date(Ymd); 

        ?>


      <?php if (($todays_date<$ending_date) and ($todays_date<$starting_date)): ?>   
        <div class="gallery-cell future-prod">
          <a href="<?php echo $slider_link; ?>" class="slider-link">            
            <?php the_post_thumbnail('hero'); ?>

            <div class="content">                  
              <h3>            
                <?php the_title(); ?>
              </h3>
              <p>
              <?php 
                $end = date_create_from_format('Ymd',$ending_date);
                $start = date_create_from_format('Ymd',$starting_date);
                echo "<span class='month'>" . $start->format('F') . "</span>";
                echo " ";
                echo "<span class='day'>" . $start->format('j') . "</span>";
                echo ", ";
                echo "<span class='year'>" . $start->format('Y') . "</span>";

                echo " - ";

                echo "<span class='month'>" . $end->format('F') . "</span>";
                echo " ";
                echo "<span class='day'>" . $end->format('d') . "</span>";
                echo ", ";
                echo "<span class='year'>" . $end->format('Y') . "</span>";
                echo ", $location";
               ?> 
              </p>
              <p>              
                <?php echo wp_trim_words( get_the_content(), 40, '...' ); ?>
              </p>
              <h4 class="status coming-soon">
                Coming Soon
              </h4>
            </div>
          </a>
        </div> <!-- /.gallery-cell.future-pro -->
      <?php endif ?>

    <?php endwhile; ?>

<!-- PAST PRODUCTION -->       
    <?php // query posts
      $params = array(
        'post_type' => 'productions',
        'post' => $id,
        'posts_per_page' => -1,
        'meta_key' => 'ending_date',
        'orderby' => 'meta_value',
        'order' => DEC,
      );

      $slider_posts = new WP_Query($params);
    ?>

    <?php if ( $slider_posts->have_posts() ) while ( $slider_posts->have_posts() ) : $slider_posts->the_post(); ?>          

      <?php date_default_timezone_set('America/New_York'); 
        $slider_link = get_permalink();
        $starting_date = get_field('starting_date'); 
        $ending_date = get_field('ending_date'); 
        $location = get_field('location'); 
        $prod_link = get_permalink(); 
        $todays_date = date(Ymd); ?>

      <?php if ($ending_date<$todays_date): ?>   
        <div class="gallery-cell past-prod">
          <a href="<?php echo $slider_link; ?>" class="slider-link">            
            <?php the_post_thumbnail('hero'); ?>

            <div class="content">  
              <h3>            
                <?php the_title(); ?>
              </h3>
              <p>              
                <?php echo wp_trim_words( get_the_content(), 40, '...' ); ?>
              </p>
              <h4 class="status coming-soon">
                Past Production
              </h4>
            </div>
          </a>
        </div> <!-- /.gallery-cell.past-prod -->
      <?php endif ?>

    <?php endwhile; ?>


    <?php $prod_link = get_permalink(11); ?>
    <div class="gallery-cell read-more">
      <a href="<?php echo $prod_link; ?>" class="slider-news">
        <h4 class="slider-news">READ MORE</h4>
      </a>
    </div> <!-- /.gallery-cell.read-more -->
</div> <!-- /.gallery -->

 

在我的开发工具中检查控制台错误后,它出现了以下错误。有什么建议吗?

未捕获的ReferenceError:未定义jQuery     在jquery-migrate.min.js:2 (索引):87未捕获的ReferenceError:未定义jQuery     在(指数):87

1 个答案:

答案 0 :(得分:0)

你应该调试你的错误,使用浏览器的开发者工具并检查它会显示所有的控制台错误,我认为所有文件都没有正确上传,或者你可以检查你上传的文件和文件夹的权限问题并更新filezilla或您使用的任何其他ftp客户端的权限