저는 초보자이며 첫 번째 테마를 개발하려고합니다.Wordpress 사용자 정의 게시물 유형 페이지 매기기 404 페이지 2
불행히도 맞춤형 게시물 유형 (projet)에 문제가 있습니다. 이 항목 (query_post, WP_Query, 플러시 permalinks, 등)에 대해 발견 된 다른 조합을 시도했지만 아무도 날 위해 일하는 것.
나는 wp_pagenavi 플러그인을 사용하려고합니다. 여기
는 function.php에, 내 레지스터 포스트 유형 :이 코드는 현재<ul id="list-projets" class="grid cs-style-7">
<?php if (get_query_var('paged')) {
$paged = get_query_var('paged');
} else if (get_query_var('page')) {
$paged = get_query_var('page');
} else {
$paged = 1;
} ?>
<?php
$args= array(
'showposts' => 2,
'posts_per_page' => 2,
'post_type' => 'projet',
'paged' => $paged
);
$the_query = new WP_Query($args);
if ($the_query->have_posts()): while ($the_query->have_posts()) : $the_query->the_post(); ?>
<li>
<figure>
<?php the_post_thumbnail(); ?>
<h3><?php the_title(); ?></h3>
<figcaption>
<span><?php echo get_the_excerpt(); ?></span>
<a href="<?php the_permalink(); ?>">+ de détails</a>
</figcaption>
</figure>
</li>
<?php endwhile; ?>
<?php endif;
wp_reset_query(); ?>
<nav>
<?php wp_pagenavi(array('query' => $the_query)); ?>
</nav>
</ul>
: 여기
register_post_type('projet', array(
'label' => __('Réalisations'),
'singular_label' => __('Projet'),
'public' => true,
'show_ui' => true,
'rewrite' => array('slug' => 'international/realisations', 'with_front' => true),
'hierarchical' => false,
'has-archive' => true,
'query_var' => true,
'supports' => array('title', 'excerpt', 'editor', 'thumbnail', 'page-attributes')
));
내 사용자 정의 포스트 유형 "인텔리을"목록 템플릿의 코드입니다 마지막 사용자 정의 게시물 유형 "projet"과 페이지 매김을 나열하지만, 페이지 2를 클릭하면 404 오류가 표시됩니다. url은/localhost/wordpress/international/realizations/page/2/
내 등록 게시물 유형에 'has_archive'= true를 추가하려고했지만 permalinks를 저장하고 플러시하고 내 목록 페이지로 돌아 가려고했습니다./localhost/wordpress/international/realizations/페이지가 비어 있고 내 빵가죽이 "ACCUEIL> INTERNATIONAL> RÉALISATIONS"대신에 더 이상 "ACCUEIL> RÉALISATIONS"이 아닙니다.
나는 초심자인데 어쩌면 내가 잘못했기 때문에 며칠을 찾고 있었기 때문에 나를 도와주세요. 나는 무엇을 해야할지 몰라!
또한이 솔루션 (여전히 404)을이 link에서 테스트했습니다. 이
<nav>
<?php wp_pagenavi(array('query' => $the_query)); ?>
</nav>
이용
안녕 모두, 마지막으로 내가 나를 위해 작동하는 솔루션을 발견 http://somadesign.ca/projects/smarter-custom-post-types/ – TiergAu
사용자 정의 분류를 위해 슬러그를 다시 작성할 때까지 작동하지 않습니다. 나는 같은 문제가 있었고 대답을 [여기 StackOverflow에] (http://stackoverflow.com/a/37223124/1305969) : – jewelfarazi