私はワードプレスのページネーションに取り組んでいます。コードに問題があります。ページネーションはメインページで正常に機能しています。タグページとカテゴリページで404エラーが表示されます。タグまたはカテゴリに移動すると、最初は問題なく表示されますが、次のページに移動すると、404ページエラーが表示されます。
ここにページネーションコードがあります。
<?php
function kriesi_pagination($pages = '', $range = 2)
{
$showitems = ($range * 2)+1;
global $paged;
if(empty($paged)) $paged = 1;
if($pages == '')
{
global $wp_query;
$pages = $wp_query->max_num_pages;
if(!$pages)
{
$pages = 1;
}
}
if(1 != $pages)
{
echo "<div class='pagination'>";
if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "<a href='".get_pagenum_link(1)."'>«</a>";
if($paged > 1 && $showitems < $pages) echo "<a href='".get_pagenum_link($paged - 1)."'>‹</a>";
for ($i=1; $i <= $pages; $i++)
{
if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems ))
{
echo ($paged == $i)? "<span class='current'>".$i."</span>":"<a href='".get_pagenum_link($i)."' class='inactive' >".$i."</a>";
}
}
if ($paged < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($paged + 1)."'>›</a>";
if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "<a href='".get_pagenum_link($pages)."'>»</a>";
echo "</div>\n";
}
}
?>
ここにループがあります
<?php global $wp_query;
$args = array_merge( $wp_query->query_vars, array( 'post_type' => 'fahrzeug' ) );
query_posts( $args );
if ( have_posts() ) : while ( have_posts() ) : the_post();
$omc_review_enable = get_post_meta(get_the_ID(), 'omc_review_enable', true);
$omc_final_score = get_post_meta(get_the_ID(), 'omc_final_score', true);
$omc_final_percentage = $omc_final_score * 20 ;
$format = get_post_format();
if ( false === $format )
$format = 'standard';
?>
<article class="omc-blog-two omc-half-width-category" id="post-<?php the_ID(); ?>">
<?php
global $h_sticky;
global $displayed;
$home_page = get_option ('shareit_home', 0);
if (!$displayed and $h_sticky && $home_page == 1) {
echo $h_sticky;
$displayed = true;
}
?>
<div class="omc-resize-290 omc-blog">
<?php $category = get_the_category();?>
<h3 class="omc-blog-two-cat"><a href="<?php echo home_url(); echo ('/?cat='.$category[0]->term_id); ?>"><?php echo $category[0]->cat_name; ?></a></h3>
<?php if ($omc_review_enable == 1) { ?><span class="omc-blog-two-stars-under leading-article"><span class="omc-blog-two-stars-over leading-article" style="width:<?php echo $omc_final_percentage; ?>%"></span></span><?php } ?>
<a href="<?php the_permalink();?>" >
<?php if ($format == 'video' || $format == 'audio') { ?><span class="module-a-video-icon-big omc-half-width-icon omc-module-b-left"></span><?php } ?>
<?php if (has_post_thumbnail()) {
//Changes made by wisdmlabs starts
//the_post_thumbnail('half-landscape', array('class' => 'omc-image-resize')); //this is the original line
the_post_thumbnail('mycustomsize',array('class'=>'custom-img-size'));
//changes made by wisdmlabs ends
} else {
//echo('<img src="'.get_template_directory_uri().'/images/no-image-half-landscape.png" class="omc-image-resize" alt="no image" />');
} ?>
</a>
</div><!-- /omc-resize-290 -->
<div class="omc-blog-two-text">
<h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
<!--
<p class="omc-blog-two-date">
<?php
the_time('F jS, Y') ?> | <em><?php
_e('by', 'gonzo'); ?> <?php the_author() ?></em></p>
-->
<p class="omc-blog-two-exceprt" ><?php wpe_excerpt('blog_2', 'wpe_excerptmore'); ?></p>
<a href="<?php echo do_shortcode('[wpv-post-field name="Webseite zum Fahrzeug"]'); ?>" target="_blank" ><!--<?php echo do_shortcode('[wpv-post-field name="Webseite zum Fahrzeug"]'); ?>--><button class="btn_map" style="background-color:red;
" ><span class="button_title">Zum Anbieter</span></button></a>
<br class="clear" />
</div><!-- /omc-blog-two-text -->
</article>
<?php
//
//kriesi_pagination(2,2);
//
endwhile; endif; ?>
<br class="clear" />
<?php
kriesi_pagination();
wp_reset_query();
?>
誰でも何が悪いのか助けてもらえますか????