wordpress/wp-content/themes/basic/themify/class-hook-contents.php
/**
	 * Render pagination for specific page.
	 *
	 * @param Integer $current_page The current page that needs to be rendered.
	 * @param Integer $num_of_pages The number of all pages.
	 *
	 * @return String The HTML with pagination.
	 */
Render pagination for specific page.
@param Integer $current_page The current page that needs to be rendered.
@param Integer $num_of_pages The number of all pages.

@return String The HTML with pagination.
Render pagination for specific page . @param Integer $current_page The current page that needs to be rendered . @param Integer $num_of_pages The number of all pages . @return String The HTML with pagination .
function create_page_pagination( $current_page, $num_of_pages ) {
		$links_in_the_middle = 4;
		$links_in_the_middle_min_1 = $links_in_the_middle - 1;
		$first_link_in_the_middle   = $current_page - floor( $links_in_the_middle_min_1 / 2 );
		$last_link_in_the_middle    = $current_page + ceil( $links_in_the_middle_min_1 / 2 );
		if ( $first_link_in_the_middle <= 0 ) {
			$first_link_in_the_middle = 1;
		}
		if ( ( $last_link_in_the_middle - $first_link_in_the_middle ) != $links_in_the_middle_min_1 ) {
			$last_link_in_the_middle = $first_link_in_the_middle + $links_in_the_middle_min_1;
		}
		if ( $last_link_in_the_middle > $num_of_pages ) {
			$first_link_in_the_middle = $num_of_pages - $links_in_the_middle_min_1;
			$last_link_in_the_middle  = (int) $num_of_pages;
		}
		if ( $first_link_in_the_middle <= 0 ) {
			$first_link_in_the_middle = 1;
		}
		$pagination = '';
		if ( $current_page != 1 ) {
			$pagination .= '<a href="/page/' . ( $current_page - 1 ) . '" class="prev page-numbers ti-angle-left"/>';
		}
		if ( $first_link_in_the_middle >= 3 && $links_in_the_middle < $num_of_pages ) {
			$pagination .= '<a href="/page/" class="page-numbers">1</a>';
			if ( $first_link_in_the_middle != 2 ) {
				$pagination .= '<span class="page-numbers extend">...</span>';
			}
		}
		for ( $i = $first_link_in_the_middle; $i <= $last_link_in_the_middle; $i ++ ) {
			if ( $i == $current_page ) {
				$pagination .= '<span class="page-numbers current">' . $i . '</span>';
			} else {
				$pagination .= '<a href="/page/' . $i . '" class="page-numbers">' . $i . '</a>';
			}
		}
		if ( $last_link_in_the_middle < $num_of_pages ) {
			if ( $last_link_in_the_middle != ( $num_of_pages - 1 ) ) {
				$pagination .= '<span class="page-numbers extend">...</span>';
			}
			$pagination .= '<a href="/page/' . $num_of_pages . '" class="page-numbers">' . $num_of_pages . '</a>';
		}
		if ( $current_page != $last_link_in_the_middle ) {
			$pagination .= '<a href="/page/' . ( $current_page + $i ) . '" class="next page-numbers ti-angle-right"></a>';
		}
		return $pagination;
	}
function create_page_pagination ( $ current_page , $ num_of_pages ) { $ links_in_the_middle = 4 ; $ links_in_the_middle_min_1 = $ links_in_the_middle - 1 ; $ first_link_in_the_middle = $ current_page - floor ( $ links_in_the_middle_min_1 / 2 ) ; $ last_link_in_the_middle = $ current_page + ceil ( $ links_in_the_middle_min_1 / 2 ) ; if ( $ first_link_in_the_middle <= 0 ) { $ first_link_in_the_middle = 1 ; } if ( ( $ last_link_in_the_middle - $ first_link_in_the_middle ) != $ links_in_the_middle_min_1 ) { $ last_link_in_the_middle = $ first_link_in_the_middle + $ links_in_the_middle_min_1 ; } if ( $ last_link_in_the_middle > $ num_of_pages ) { $ first_link_in_the_middle = $ num_of_pages - $ links_in_the_middle_min_1 ; $ last_link_in_the_middle = ( int ) $ num_of_pages ; } if ( $ first_link_in_the_middle <= 0 ) { $ first_link_in_the_middle = 1 ; } $ pagination = '' ; if ( $ current_page != 1 ) { $ pagination .= '<a href="/page/' . ( $ current_page - 1 ) . '" class="prev page-numbers ti-angle-left"/>' ; } if ( $ first_link_in_the_middle >= 3 && $ links_in_the_middle < $ num_of_pages ) { $ pagination .= '<a href="/page/" class="page-numbers">1</a>' ; if ( $ first_link_in_the_middle != 2 ) { $ pagination .= '<span class="page-numbers extend">...</span>' ; } } for ( $ i = $ first_link_in_the_middle ; $ i <= $ last_link_in_the_middle ; $ i ++ ) { if ( $ i == $ current_page ) { $ pagination .= '<span class="page-numbers current">' . $ i . '</span>' ; } else { $ pagination .= '<a href="/page/' . $ i . '" class="page-numbers">' . $ i . '</a>' ; } } if ( $ last_link_in_the_middle < $ num_of_pages ) { if ( $ last_link_in_the_middle != ( $ num_of_pages - 1 ) ) { $ pagination .= '<span class="page-numbers extend">...</span>' ; } $ pagination .= '<a href="/page/' . $ num_of_pages . '" class="page-numbers">' . $ num_of_pages . '</a>' ; } if ( $ current_page != $ last_link_in_the_middle ) { $ pagination .= '<a href="/page/' . ( $ current_page + $ i ) . '" class="next page-numbers ti-angle-right"></a>' ; } return $ pagination ; }
Render pagination for specific page.
Render pagination for specific page .