ap_answers_the_pagination()

Description #

Output answers pagination. Should be used inside a loop.

Source #

File: includes/answer-loop.php

function ap_answers_the_pagination() {
	if ( get_query_var( 'answer_id' ) ) {
		echo '<a class="ap-all-answers" href="' . esc_url( get_permalink( get_question_id() ) ) . '">' .
		// translators: %d is total answer count of question.
		esc_attr( sprintf( __( 'You are viewing 1 out of %d answers, click here to view all answers.', 'anspress-question-answer' ), ap_get_answers_count( get_question_id() ) ) ) . '</a>';
	} else {
		global $answers;
		$paged = ( get_query_var( 'ap_paged' ) ) ? get_query_var( 'ap_paged' ) : 1;
		ap_pagination( $paged, $answers->max_num_pages, '?ap_paged=%#%', get_permalink( get_question_id() ) . 'page/%#%/' );
	}
}

Leave a Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Add your comment