前後ボタンはdisable
クラスがつくので、cssで制御する
<?php $count_custom = wp_count_posts('cases'); $custom_posts = (int)$count_custom->publish; if ($custom_posts > 2) : //2ページ目からページネーションが出現するように ?> <script> $(".tabs").tabpager({ items: 2, contents: 'study-list', //time: 300, previous: '', next: '', start: 1, position: 'bottom', scroll: true }); // ページネーションクリックしたらページ上部へスクロール $(document).on('click', '#jquery-tab-pager-navi li a', function() { if ($(this).hasClass('current')) { $('html,body').stop(false, false); } else { $('html,body').animate({ scrollTop: 100 }, 500); } }); //pagerが1しかない時は非表示 let navi_count = $('#jquery-tab-pager-navi li').length; if (navi_count <= 3) { $('#jquery-tab-pager-navi').hide(); } </script> <?php endif; ?>