把这个功能放在你身上functions.php
-
function the_dramatist_wp_link_pages( $args = \'\' ) {
global $page, $numpages, $multipage, $more;
$defaults = array(
\'before\' => \'<p>\' . __( \'Pages:\' ),
\'after\' => \'</p>\',
\'link_before\' => \'\',
\'link_after\' => \'\',
\'next_or_number\' => \'number\',
\'separator\' => \' \',
\'nextpagelink\' => __( \'Next page\' ),
\'previouspagelink\' => __( \'Previous page\' ),
\'pagelink\' => \'%\',
\'echo\' => 1
);
$params = wp_parse_args( $args, $defaults );
/**
* Filters the arguments used in retrieving page links for paginated posts.
*
* @since 3.0.0
*
* @param array $params An array of arguments for page links for paginated posts.
*/
$r = apply_filters( \'wp_link_pages_args\', $params );
$output = \'\';
if ( $multipage ) {
if ( \'number\' == $r[\'next_or_number\'] ) {
$output .= $r[\'before\'];
for ( $i = 1; $i <= $numpages; $i++ ) {
if ( $i % 2 == 0) {
$link = $r[\'link_before\'] . str_replace( \'%\', \'Answer\', $r[\'pagelink\'] ) . $r[\'link_after\'];
} else {
$link = $r[\'link_before\'] . str_replace( \'%\', \'Question\', $r[\'pagelink\'] ) . $r[\'link_after\'];
}
if ( $i != $page || ! $more && 1 == $page ) {
$link = _wp_link_page( $i ) . $link . \'</a>\';
}
/**
* Filters the HTML output of individual page number links.
*
* @since 3.6.0
*
* @param string $link The page number HTML output.
* @param int $i Page number for paginated posts\' page links.
*/
$link = apply_filters( \'wp_link_pages_link\', $link, $i );
// Use the custom links separator beginning with the second link.
$output .= ( 1 === $i ) ? \' \' : $r[\'separator\'];
$output .= $link;
}
$output .= $r[\'after\'];
} elseif ( $more ) {
$output .= $r[\'before\'];
$prev = $page - 1;
if ( $prev > 0 ) {
$link = _wp_link_page( $prev ) . $r[\'link_before\'] . $r[\'previouspagelink\'] . $r[\'link_after\'] . \'</a>\';
/** This filter is documented in wp-includes/post-template.php */
$output .= apply_filters( \'wp_link_pages_link\', $link, $prev );
}
$next = $page + 1;
if ( $next <= $numpages ) {
if ( $prev ) {
$output .= $r[\'separator\'];
}
$link = _wp_link_page( $next ) . $r[\'link_before\'] . $r[\'nextpagelink\'] . $r[\'link_after\'] . \'</a>\';
/** This filter is documented in wp-includes/post-template.php */
$output .= apply_filters( \'wp_link_pages_link\', $link, $next );
}
$output .= $r[\'after\'];
}
}
/**
* Filters the HTML output of page links for paginated posts.
*
* @since 3.6.0
*
* @param string $output HTML output of paginated posts\' page links.
* @param array $args An array of arguments.
*/
$html = apply_filters( \'wp_link_pages\', $output, $args );
if ( $r[\'echo\'] ) {
echo $html;
}
return $html;
}
然后转到主题目录。搜索并替换
wp_link_pages
函数名称
the_dramatist_wp_link_pages
. 它会按照你的意愿工作。通常是
wp_link_pages
存在于
content-{template-name}.php
. 所以,如果您的主题中有任何这些文件,请先查看主题。这里我添加了一个屏幕截图-
然后再做造型。玩得高兴
The function works on odd-even basis. It considers the odd part as \'Question\' and the even part as \'Answer\'