我使用此方法
}
else if (e9.getText().toString().equals("")) {
e9.setError("Password is required");
Toast.makeText(getApplicationContext(), "Please enter Password", Toast.LENGTH_SHORT).show();
j = 0;
}
else if (!e8.getText().toString().equals(e9.getText().toString()))
{
e9.setError("Both Passwordsxmvbxb are different");
Toast.makeText(getApplicationContext(), "Please enter Correct Password", Toast.LENGTH_SHORT).show();
k = 0;
}
现在我想为此创建一个分页。我尝试了很多,但没有什么对我有用。我应该如何修改此代码以创建分页?
答案 0 :(得分:0)
试试这个:
$args = array(
'posts_per_page' => 4,
'offset' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
'paged' => (get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1),
'suppress_filters' => true);
分页链接的示例代码:
the_posts_pagination( array(
'prev_text' => __( 'Previous page', 'custom' ),
'next_text' => __( 'Next page', 'custom' ),
'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'P\
age', 'custom' ) . ' </span>',
) );
答案 1 :(得分:0)
尝试这样做适用于自定义帖子
$args = array(
'posts_per_page' => 4,
'offset' => 0,
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'post',
'post_status' => 'publish',
'paged' => (get_query_var( 'paged' ) ? get_query_var( 'paged' ) : 1),
'suppress_filters' => true);
用于分页链接
$argsp = array(
'base' => '%_%',
'format' => '?paged=%#%',
'total' => 5,
'current' => 2,
'show_all' => false,
'end_size' => 1,
'mid_size' => 2,
'prev_next' => true,
'prev_text' => __('« Previous'),
'next_text' => __('Next »'),
'type' => 'plain',
'add_args' => false,
'add_fragment' => '',
'before_page_number' => '',
'after_page_number' => ''
);
echo paginate_links( $argsp );