add nofollow and _blank target to wordpress author bio

wordpress seo tips, Here in this article, we shown how to add nofollow and _blank target to wordpress author bio (Biographical Info) section. I am writing blog since 2008. I written on many topics and many blogs. I always accept article from guest author. Some of guest author want to publish their company or personal information in author bio section.

Some months before google changed search engine algorithm. Google look in blog, how many direct out links are used in site. I have many author articles and bio section published in our blogs. We decided to add Nofollow and new tab link attribute in for author bio section.

add nofollow and _blank target to wordpress author bio

If you manually try to add blank target and nofollow for anchor tag. wordpress removes nofollow and target from author bio section using hook.

add nofollow and _blank target to wordpress author bio
add nofollow and _blank target to wordpress author bio

We used simple str_replace method to modify the author bio section.

We created post-author.php file and added following code in that file.

if ( ! function_exists( 'wpapi_post_author' ) ) {

function wpapi_post_author() {

// Only display for standard posts
global $post;
$post_id = $post->ID;
if ( 'post' !== get_post_type($post_id) ) return;

// Vars
$author = get_the_author();
$author_description = get_the_author_meta( 'description' );
$author_description = str_replace('href','rel="nofollow" target="_blank" href', $author_description);
$author_url = esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) );
$author_avatar = get_avatar( get_the_author_meta( 'user_email' ), apply_filters( 'wpapi_author_bio_avatar_size', 75 ) );

// Only display if author has a description
if ( !$author_description ) return; ?>

<div class="author-info boxed clr">
<h4 class="heading"><span><?php printf( __( 'Written by %s', 'wpapi' ), $author ); ?></span></h4>
<div class="author-info-inner clr">
<?php if ( $author_avatar ) { ?>
<a href="<?php echo $author_url; ?>" rel="author" class="author-avatar">
<?php echo $author_avatar; ?>
</a>
<?php } ?>
<div class="author-description">
<p><?php echo $author_description; ?></p>
</div><!-- .author-description -->
</div><!-- .author-info-inner -->
</div><!-- .author-info -->

<?php } // End function

} // End if

After this we added following line in functions.php file


// Outputs post author bio
require( get_template_directory() .'/functions/post-author.php' );

If you dont want to create separate file than you can directly add above code in functions.php file.

Above code replace all herf with rel=”nofollow” target=”_blank” href tag. When we add any link in author bio section that will replaced.

This really useful for wordpress website SEO because google will trust URLs in author section.

how to add h1 tag in wordpress homepage in theme

As a SEO specialist, We know the importance of h1 and h2 tag in wordpress website. Here we will show you, how to add h1 tag to wordpress homepage in theme code.

how to add h1 tag in wordpress homepage in theme

There are many custom wordpress themes which has poor SEO. We need check every aspect of SEO friendliness of wordpress theme. recently, we faced same issue with one of our site. When we checked the website in SEO doctor  Firefox addon. We did not find h1 tag on homepage. We got the following message.

 

h1 tag missing from homepage
how to add h1 tag in wordpress homepage in theme

When, we checked message. We found following error.

“Fail”,”H1 tag”,”* You have no H1 tags”
“Fail”,”H2 tag”,”* 10 H2 tags found before/without H1 (“Demo post 12″)”

Many custom developer talking about following solution. This will not display h1 to a visitor but will to a search engine.

<h1 style="display: none;"><!--?php the_title(); ?-->

 But we are not agree with above solution. do not use above solution. Google and other search engine did not consider hidden text or very small font words.

Solution

On Home page, For post title tag you should h1 tag. If you use multiple h1 tags in single webpage, that is not harmful. You should use rel bookmark in tag. For home page use following code.


<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php if ( is_single() ) : ?>
<h1 class="entry-title"><!--?php the_title(); ?-->
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php else : ?>
<h1 class="entry-title">
php the_permalink(); ?>" rel="bookmark"><!--?php the_title(); ?-->
</h1>
<!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php endif; // is_single() ?>

Why Rel bookmark is used?

REL=Bookmark Bookmarks are used to provide direct links to key entry points into an extended document. The TITLE attribute may be used to label the bookmark. Several bookmarks may be defined in each document, and provide a means for orienting users in extended documents.

Reference Taken from : http://www.w3.org/MarkUp/html3/dochead.html

Conclusion

You can use style or classes as per your theme requirement.  The h1 is used in header.php for Custom Logo / Site Title, so there should be a H1 there. But If you used only logo image and not used h1 tag on home page than above issue will happen. You can use multiple h1 tags in one webpage. You can check wordpress core themes and their code and refer it. It has best SEO practice followed.

In core wordpress themes, We can see multiple H1 tags with rel bookmark element. So you can use above code in your wordpress theme and increase your website SEO.