How to add ‘NoFollow’ to WP-PageNavi

WordPress is a simple to use blogging tool. Fortunately, wordpress has many plugins and themes.

With a few clicks, WordPress can become a full fledged Content Management System (CMS).

Plugin Download Iink: https://wordpress.org/plugins

Theme Download Link: https://wordpress.org/themes/

Let’s talk about paging plugins today. (WP-PageNavi

Why use WP-PageNavi

Do you want to replace the old post? This plugins can help you. It provides the wp_pagenavi() template tag which generates fancy pagination links. Very useful plugin.

How to use WP-PageNavi

In the Twentyten theme, it looks like this:

<div class="nav-previous"><?php next_posts_link( __( '<span class="meta-nav">&larr;</span> Older posts', 'twentyten' ) ); ?></div>
<div class="nav-next"><?php previous_posts_link( __( 'Newer posts <span class="meta-nav">&rarr;</span>', 'twentyten' ) ); ?></div>

You would replace those two lines with this:

<!--?php wp_pagenavi(); ?-->

For multipart pages, you would look for code like this:

<!--?php wp_link_pages( ... ); ?-->

and replace it with this:

<!--?php wp_pagenavi( array( 'type' =&gt; 'multipart' ) ); ?-->

Go to WP-Admin -> Settings -> PageNavi for configuration.

Detailed description Download link:

https://wordpress.org/plugins/wp-pagenavi/

But this plugin is not friendly to Seo. Every link is dofollow!!!

The weight of high and low ranking web site is fundamental, to web site for stable and reliable rankings, improve the weight should not be ignored.

This is why i decide to write this post.

How to add ‘NoFollow’ to WP-PageNavi?

1.open wp-pagenavi/core.php page find this code:

function _wp_pagenavi_single( $page, $class, $raw_text, $format = ‘%PAGE_NUMBER%’ ) {
if ( emptyempty( $raw_text ) )
return ”;

$text = str_replace( $format, number_format_i18n( $page ), $raw_text );

return “<a href="'”" esc_url="" get_pagenum_link="" page="" class="’$class’">$text</a>”;
}

Replace:

function _wp_pagenavi_single( $page, $class, $raw_text, $format = ‘%PAGE_NUMBER%’ ) {
if ( emptyempty( $raw_text ) )
return ”;

$text = str_replace( $format, number_format_i18n( $page ), $raw_text );

return “<a rel="’nofollow’" href="'”" esc_url="" get_pagenum_link="" page="" class="’$class’">$text</a>”;
}

Notice: Use single quotation marks!

How to add ‘NoFollow’ to Next-page and Previous-page

The same question – every link is dofollow. Change it!

1.open wp-includes/link-template.php, find this code:

( $max_page, false )

Replace:

Add rel='nofollow' before '</a>'

2. Search previous_posts( false )

Add rel="nofollow" before '</a>'

Notice:One is single quotation mark, the other is double quotation mark.

Here’s good luck to you!