• Hi there,

    It would be great if all the links (a-tags) within the page navi (div with class “wp-pagenavi”) contained a title attribute, e.g. saying “page 1” or “page 3” etc.

    Maybe there could also be an option to (de)activate it – for those who (don’t) like titles. 😉

    Thanks and best regards from Germany, Chris 😉

    http://wordpress.org/extend/plugins/wp-pagenavi/

Viewing 2 replies - 1 through 2 (of 2 total)
  • +1
    Especially as the default prev/next links (») are non-descript without it.

    Obviously localization should be added to the title text as well. May be via the settings panel ?

    FYI

    I’m currently using the following code as a temporary solution making use of the echo variable which was added in v2.8.3.
    I’ve also included the assistive text variable for screen readers (accessibility).

    if( function_exists( 'wp_pagenavi' ) ) {
    	$navi = wp_pagenavi( array( 'echo' => false ) );
    
    	// Add screen reader assistive text
    	// Add title tags to page navigation
    	$patterns = array(
    		'/<div class=[\'"]wp-pagenavi[\'"]>/',
    		'/class=[\'"]first[\'"]/',
    		'/class=[\'"]previouspostslink[\'"]/',
    		'/class=[\'"]nextpostslink[\'"]/',
    		'/class=[\'"]last[\'"]/',
    		'/class=[\'"]page (smaller|larger)[\'"]>([0-9]+)</',
    	);
    	$replacements = array(
    		'<div class="wp-pagenavi">' . "\n\t\t\t\t" . '<h3 class="assistive-text">' . __( 'Post navigation', 'twentyeleven' ) . '</h3>',
    		'title="Go to the first page" class="first"',
    		'title="Go to the previous page" class="previouspostslink"',
    		'title="Go to the next page" class="nextpostslink"',
    		'title="Go to the last page" class="last"',
    		'title="Go to page $2" class="page $1">$2<',
    	);
    	$navi = preg_replace( $patterns, $replacements, $navi );
    
    	// display it
    	echo $navi;
    }

    Hope this helps others running into the same issue.

    Smile,
    Juliette

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Plugin: WP-PageNavi] title attribute for links’ is closed to new replies.