我正在完成自定义布局。
这是我自定义帖子类型的代码
<?php
/* ------------------ [ CUSTOM POST TYPE ] ------------------------- */
add_action( \'init\', \'create_post_type\' );
function create_post_type() {
register_post_type( \'notizia\',
array(
\'labels\' => array(
\'name\' => __( \'Notizie\' ),
\'singular_name\' => __( \'Notizia\' )
),
\'public\' => true,
\'has_archive\' => true,
\'rewrite\' => array(\'slug\' => \'notizia\'),
\'menu_icon\' => get_bloginfo(\'template_directory\') . \'/images/amministrazione/notizia.png\',
\'supports\' => array(\'title\',\'thumbnail\',\'excerpt\',\'editor\',\'author\',\'custom-fields\',\'comments\', \'post-formats\')
)
);
register_post_type( \'recensione\',
array(
\'labels\' => array(
\'name\' => __( \'Recensioni\' ),
\'singular_name\' => __( \'Recensione\' )
),
\'public\' => true,
\'has_archive\' => true,
\'rewrite\' => array(\'slug\' => \'recensione\'),
\'menu_icon\' => get_bloginfo(\'template_directory\') . \'/images/amministrazione/software.png\',
\'supports\' => array(\'title\',\'thumbnail\',\'excerpt\',\'editor\',\'author\',\'custom-fields\',\'comments\')
)
);
}
?>
下面是分类代码
<?php
register_taxonomy(
\'tipologia\',
\'recensione\',
array(
\'label\' => __( \'Tipologia\' ),
\'rewrite\' => array( \'slug\' => \'tipologia\' ),
\'hierarchical\' => false
)
);
register_taxonomy(
\'piattaforma\',
\'recensione\',
array(
\'label\' => __( \'Piattaforma\' ),
\'rewrite\' => array( \'slug\' => \'piattaforma\' ),
\'hierarchical\' => false
)
);
register_taxonomy(
\'produttore\',
\'recensione\',
array(
\'label\' => __( \'Produttore\' ),
\'rewrite\' => array( \'slug\' => \'produttore\' ),
\'hierarchical\' => false
)
);
register_taxonomy(
\'argomenti\',
\'notizia\',
array(
\'label\' => __( \'Argomenti Notizia\' ),
\'rewrite\' => array( \'slug\' => \'argomenti\' ),
\'hierarchical\' => false
)
);
?>
我正试着把它放进档案室。php正常循环:每页12篇文章+分页。问题是,并非所有解决方案都有效=404
例如,这段代码在前2页是可以的(这是一个测试)。当你到达第三页时,你会看到一个漂亮的404:)
<?php
$temp = $wp_query;
$wp_query = null;
$wp_query = new WP_Query();
$wp_query->query(\'showposts=2&post_type=recensione\'.\'&paged=\'.$paged);
while ($wp_query->have_posts()) : $wp_query->the_post();
?>
CONTENT
<?php endwhile; get_pagination();?>
<?php $wp_query = null;$wp_query=$temp;?>
Notes
<这不是错误。已经使用和不使用)进行了一些故障排除已经尝试了Monkeyman重写分析器,我看permalink结构没有任何问题
如果我使用简单的if、while、endwhile、endif,那么每个页面的插件自定义帖子就解决了问题,但我很好奇,不使用这个插件就想了解问题的根源,你有什么解决方案吗?:)