-->

Wednesday, December 28, 2011

How To Remove Image Title Tag In WordPress?



A title attribute of an image is normally used to show any text when you hover the mouse over the image. In some cases you may want to remove these title tags from your blog. We can do this by three methods.
  1. Install a WordPress Plugin
  2. Edit function.php and add our own code
  3. Using Javascript
1) Install a Wordpress plugin

For removing all the title attributes of images from your blog you can use IMG Title Removal plugin. This plugin will filter all the title attribute tags before sending them to the browser. Just install this IMG Title Removal plugin and activate it in your blog. Now please check your blog. You can’t see any titles for your images anymore there.

Click here to download this plugin. And if you need any help regarding plugin installation and activation please visit this article.

2) Edit function.php

 This is  the other method. Just add the below php code in to your function.php page.

<?php

add_filter('the_content', 'remove_titles');

function remove_titles($txt) {

// Get all title="..." tags from the html.
$txtresult= array();
preg_match_all('|title="[^"]*"|U', $txt, $txtresult);

// Replace all occurances with an empty string.
foreach($txtresult[0] as $img_tag) {
$text = str_replace($img_tag, '', $txt);
}

return $txt;
}
?>

3) Using JavaScript

Another method would be dynamically removing the title attribute after they have been called on the page. Actually title tags are playing a good role in SEO. So if you actually want to remove title tag, then I will recommend this method because this method will only remove the tool tips and the title tags can be seen in html .

Example for using JavaScript:

jQuery(document).ready(function($) {
$('img[title]').each(function() { $(this).removeAttr('title'); });
});




Kindly Bookmark this Post using your favorite Bookmarking service:
Technorati Digg This Stumble Stumble Facebook Twitter

1 comments :

Anonymous said...

I am sure this post has touched all the internet users, its really really pleasant
post on building up new blog.
Also visit my page :: how to get my ex back

Post a Comment

Related Posts Plugin for WordPress, Blogger...
 

Recent Posts

Recent Comments

| Learn Web Tips - A Blog For Learn And Discuss Web Tricks And Tips © 2012. All Rights Reserved | Template Style by My Blogger Tricks .com | Design by Brian Gardner | | Back To Top |