###前提・実現したいこと
event organizerというプラグインを使っています。
https://ja.wordpress.org/plugins/event-organiser/
こちらでeventのカスタム投稿を作りそれをさらに
eventとholidayというtermsに分けてます。
archive-event.phpに一覧を作り、holidayは出さないようにするとこまではできたのですが、ページネーションが動きません。
ページネーションはfunctions.phpに記載したものを使用しており、
通常の投稿ページでは機能しております。
カスタム投稿初めてなので用語などの間違いがありましたら申し訳ございません。
よろしくお願いします。
###発生している問題・エラーメッセージ
ページネーションが2ページ目も同じ内容になってしまいます。
###該当のソースコード
archive-event.php
php
1<?php $my_query = new WP_Query( array( 2 'post_type' => 'event', 3 'posts_per_page' => 5, 4 'tax_query' => array( 5 array( 6 'taxonomy' => 'event-category', 7 'field' => 'slug', 8 'terms' => 'event' 9 ), 10 ), 11 12) ); ?> 13<?php if ( $my_query->have_posts() ) : while ( $my_query->have_posts() ) : $my_query->the_post(); ?> 14<div class="child_column_article"> 15<div class="child_column_article_left"> 16<?php the_post_thumbnail('full', array('class' => 'column_relative')); ?> 17<?php 18 $days = 7; 19 $today = date_i18n('U'); 20 $entry = get_the_time('U'); 21 $elapsed = date('U',($today - $entry)) / 86400; 22 if( $days > $elapsed ){ 23 echo "<img src=\"/wp-content/themes/useful/shared/images/ico_01.png\" class=\"child_column_absolute\">"; 24 } 25?> 26</div> 27<div class="child_column_article_right"> 28<h2><span><?php the_title();?></span></h2> 29<div class="event_info"> 30 <div class="event_info_step ei_upper"> 31 <p class="event_green">日時</p> 32 <p class="event_gray"><?php echo eo_get_schedule_start('Y年 n月 d日 (D)'); ?></p> 33 </div> 34 <div class="event_info_step ei_lower"> 35 <p class="event_green">場所</p> 36 <p class="event_gray"><?php echo eo_get_venue_name(); ?></p> 37 </div> 38</div> 39<div class="child_column_article_more"> 40<a href="<?php the_permalink();?>"> 41<img src="<?php echo get_template_directory_uri(); ?>/shared/images/btn_03.png" alt="MORE"> 42</a> 43</div> 44</div> 45</div> 46<?php endwhile; else : ?> 47 <p><?php _e( 'Sorry, no posts matched your criteria.' ); ?></p> 48<?php endif; wp_reset_postdata(); ?>
functions.php
php
1function wp_pagination() { 2 global $wp_query; 3 $big = 99999999; 4 $page_format = paginate_links( array( 5// 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 6 'format' => '?paged=%#%', 7// 'current' => max( 1, get_query_var('paged') ), 8 'total' => $wp_query->max_num_pages, 9 'prev_next' => True, 10 'prev_text' => __(' '), 11 'next_text' => __(' '), 12 'type' => 'array' 13 ) ); 14 if( is_array($page_format) ) { 15 $paged = ( get_query_var('paged') == 0 ) ? 1 : get_query_var('paged'); 16 //echo '<li><span>'. $paged . ' of ' . $wp_query->max_num_pages .'</span></li>'; 17 foreach ( $page_format as $page ) { 18 echo "<li>$page</li>"; 19 } 20 } 21 wp_reset_query(); 22}
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2016/11/18 02:36