This function output :
<<NEXT [SELECT] PREV>>
i need this :
<option value="link/page1">Page 1</option>
<option value="link/page2">Page 2</option>
如何将此函数转换为此函数
function yorumlariSayfala ( $args = array() ) {
global $wp_rewrite;
if ( ! is_singular() )
return;
$page = get_query_var(\'cpage\');
if ( !$page )
$page = 1;
$max_page = get_comment_pages_count();
$defaults = array(
\'base\' => add_query_arg( \'cpage\', \'%#%\' ),
\'format\' => \'\',
\'total\' => $max_page,
\'current\' => $page,
\'echo\' => true,
);
if ( $wp_rewrite->using_permalinks() )
$defaults[\'base\'] = user_trailingslashit(trailingslashit(get_permalink()) . $wp_rewrite->comments_pagination_base . \'-%#%\', \'commentpaged\');
$args = wp_parse_args( $args, $defaults );
$page_links = paginate_links( $args );
if ( $args[\'echo\'] )
echo $page_links;
else
return $page_links;
}
SO网友:Nilambar Sharma
以下是存档导航的片段,其中包含上一个和下一个链接以及选择DopDown。选择将包含所有页面的列表和作为选项值的页面url。onChange
用于在更改选择选项时重定向页面。您可以使用以下代码并根据需要进行修改。
function wpso_custom_archive_navigation() {
global $wp_query;
if ( is_singular() ) {
return;
}
if ( $wp_query->max_num_pages <= 1 ) {
return;
}
$paged = get_query_var( \'paged\' ) ? absint( get_query_var( \'paged\' ) ) : 1;
$max = intval( $wp_query->max_num_pages );
// Previous link.
if ( get_previous_posts_link() ) {
printf( \'%s\', get_previous_posts_link( \'Previous\' ) );
}
echo \'<select onChange="window.document.location.href=this.options[this.selectedIndex].value;">\';
for ( $i = 1; $i <= $max ; $i++ ) {
echo \'<option value="\' . esc_url( get_pagenum_link( $i ) ) . \'" \' . selected( $i, $paged ) . \'>\';
echo \'Page \' . $i;
echo \'</option>\';
}
echo \'</select>\';
// Next link.
if ( get_next_posts_link() ) {
printf( \'%s\', get_next_posts_link( \'Next\' ) );
}
}