クライアントサイトを一時URLに立ち上げたばかりで、CSSと仕上げが完了している間にデータ入力ができるようになりました。しかし、私がサイトを立ち上げたとき、私はそれの一部が壊れていることを発見しました。その原因はカスタムポストスライダです。なぜ私のローカルホスト上で完璧に動作するので、それが壊れているのか理解できません。コードはlocalhostでは動作しますが、サーバでは動作しません
私はFlickityと呼ばれるパックを使用しています。これまで私を非常にうまく扱ってきました。私は自分のサイトに他の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:2 (インデックス)::87キャッチされないのにReferenceError:jQueryの(インデックス)で が定義されていない:jQueryのはjqueryの-migrate.min.jsで 定義されていない87
おそらくリンクが壊れています。スクリプトとスタイルシートが正常に読み込まれているかどうかを確認してください。 – claudios
編集した質問をコンソールエラーで表示する! –