AnsPress_Rewrite::pagination_fix( array $args )

Description #

Pagination fix.

Parameters #

  • $args
    array (Required) Arguments.

Source #

File: includes/rewrite.php

	public static function pagination_fix( $args ) {
		/**
		 * Home page pagination fix,
		 * when the questions are directly used within the loop,
		 * i.e., without setting the static front page.
		 *
		 * @param array $args Arguments.
		 * @return array
		 */
		if ( is_front_page() && is_home() ) {
			return preg_replace( '/page.([0-9]+).*/', '?page=$1', $args );
		}

		/**
		 * BuddyPress pagination fix.
		 */
		if ( function_exists( 'bp_current_component' ) ) {
			$bp_com = bp_current_component();

			if ( 'questions' === $bp_com || 'answers' === $bp_com ) {
				return preg_replace( '/page.([0-9]+)./', '?paged=$1', $args );
			}
		}

		return $args;
	}

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