每个人
我已经创建了一个自定义的\\u post\\u类型;
function create_post_type_veranstaltungen()
{
register_post_type(\'veranstaltungen\', array(
\'label\' => __(\'Veranstaltungen\'),
\'public\' => true,
\'show_ui\' => true,
\'show_in_menu\' => true,
\'menu_icon\' => \'dashicons-admin-site-alt\',
\'supports\' => array(\'thumbnail\', \'title\', \'editor\', \'author\',
\'excerpt\', \'comments\'),
)
);
}
add_action(\'init\', \'create_post_type_veranstaltungen\');
有自己的分类部分
function tr_create_my_taxonomy()
{
register_taxonomy(
\'veranstaltungen-category\',
\'veranstaltungen\',
array(
\'label\' => __(\'Category\'),
\'rewrite\' => array(\'slug\' => \'veranstaltungen-category\'),
\'hierarchical\' => true,
)
);
}
add_action(\'init\', \'tr_create_my_taxonomy\');
然后我创建了4个post,并实现了相应的循环
<?php
$paged = (get_query_var(\'paged\')) ? get_query_var(\'paged\') : 1;
$custom_args = array(
\'post_type\' => \'veranstaltungen\',
\'orderby\' => \'date\',
\'order\' => \'DESC\',
\'paged\' => $paged,
\'posts_per_page\' => \'10\'
);
$wp_query = new WP_Query($custom_args);
if (have_posts()) :
while (have_posts()) : the_post();
?>
<div class="pagination">
<?php
$big = 999999999; // need an unlikely integer
echo paginate_links(array(
base\' => str_replace($big, \'%#%\', esc_url(get_pagenum_link($big))),
\'format\' => \'?paged=%#%\',
\'current\' => max(1, get_query_var(\'paged\')),
\'total\' => $wp_query->max_num_pages
));
?>
</div>
如果income posts\\u per\\u page=>“-1”有效,如果我输入posts\\u per\\u page=>“1”也有效,但如果我输入posts\\u per\\u page=>“10”根本不显示任何内容。
有人知道会发生什么吗?
谢谢