I'm using this code in order to display what page the user is

I’m using this code in order to display what page the user is.


<title><?php 
    global $page, $paged; 
    wp_title( '|', true, 'right' ); 
    bloginfo( 'name' ); 
    $site_description = get_bloginfo( 'description', 'display' ); 
    if ( $site_description && ( is_front_page() ) )
        echo " | $site_description"; 
    if ( $paged >= 2 || $page >= 2 ) 
        echo ' | ' . sprintf( __( 'Page %s' ), x( $paged, $page ) ); 
?></title>

When clicking on the navigation it seem to be working properly and it also displays the correct title. But when I click on the pagination, the website shows only a blank page.

I’m using WP-PageNavi plugin to display the pagination.

When I hovered on the tab an error appeared:

Use this code instead :


<title><?php
	/*
	 * Print the <title> tag based on what is being viewed.
	 */
	global $page, $paged;

	wp_title( '|', true, 'right' );

	// Add the blog name.
	bloginfo( 'name' );

	// Add the blog description for the home/front page.
	$site_description = get_bloginfo( 'description', 'display' );
	if ( $site_description && ( is_home() || is_front_page() ) )
		echo " | $site_description";

	// Add a page number if necessary:
	if ( $paged >= 2 || $page >= 2 )
		echo ' | ' . sprintf( __( 'Page %s' ), max( $paged, $page ) );

	?></title>

Goodluck