我在其他地方找到了以下代码,我用它分页。
虽然我读过法典,但我不完全理解。wordpress。多次查询组织/Class\\u引用/WP\\u。他们似乎在谈论新的问题。
global $wp_query, $wp_rewrite, $numposts;
$wp_query->query_vars[\'paged\'] > 1 ? $current = $wp_query->query_vars[\'paged\'] : $current = 1;
$pagination = array(
\'base\' => @add_query_arg(\'page\',\'%#%\'),
\'format\' => \'\',
\'total\' => $wp_query->max_num_pages,
\'current\' => $current,
\'show_all\' => false,
\'mid_size\' => 5,
\'type\' => \'plain\',
\'prev_next\' => True,
\'prev_text\' => __(\'[<< Prev]\'),
\'next_text\' => __(\'[Next >>]\'),
);
if ( $wp_rewrite->using_permalinks() )
$pagination[\'base\'] = user_trailingslashit( trailingslashit( remove_query_arg( \'s\', get_pagenum_link( 1 ) ) ) . \'page/%#%/\', \'paged\' );
if ( !empty($wp_query->query_vars[\'s\']) )
$pagination[\'add_args\'] = array( \'s\' => get_query_var( \'s\' ) );
有没有办法改变这一点,这样它也可以按照标题、姓名、id或其他排序方式对帖子进行排序?