Code works on localhost but not on server

3.1k views Asked by At

I have just launched my clients site to a temporary URL so they can do data input while i finish up on CSS and finishing touches. When I launched the site however, I found that part of it broke, the culprit being a custom-post slider. I don't understand why it's breaking as it works perfectly fine on my localhost.

I am using a pkg called Flickity, and it has been treating me very well up until now. I am using other Flickity sliders on my site, so I know that FLickity itself is not the problem. I have attached below my code for the slider.

The Custom Posts are Theatre Productions, and are meant to be ordered according to the closing performance date: ending_date [ACF].

<section class="slider-prod">

Our Productions

<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 -->

After checking the console errors in my Dev Tools, it came up with the following errors. Any Suggestions?

Uncaught ReferenceError: jQuery is not defined at jquery-migrate.min.js:2 (index):87 Uncaught ReferenceError: jQuery is not defined at (index):87

1

There are 1 answers

1
Noor On

You should debug your error, use developer tool of the browser and check for console errors it will show you all, I think all the files are not uploaded properly or their can be permissions issues on your uploaded files and folders you can check and update permissions from filezilla or any other ftp client you used