Add a favicon to your WordPress theme using wordpress hack

Just copy paste the following following lines to your function.php file.

function add_favicon() { ?>
<link rel=”shortcut icon” href=”<?php echo bloginfo(‘stylesheet_directory’) ?>/images/favicon.ico” >
<?php }
add_action(‘wp_head’, ‘add_favicon’);

if wp_head() function added in your header.php file, If that function not added then this hack will never work

logo

How to add facebook, twitter, rss and email button in wordpress sidebar

First you need to download the social icons from website. Make sure icons are free.

I created following steps to add the icons to wordpress site for non developers.

1. Upload the icon image(s) to your media library.

wordpressapi_social_icons
2. Add a “Text” widget to your sidebar and insert code similar to the following:

<a href=”http://twitter.com/wordpressapi”><img src=”http://images.wordpressapi.com/twitter_48x48.png”  /></a>
<a href=”http://www.facebook.com/wordpressapi”><img src=”http://images.wordpressapi.com/facebook_48x48.png” /></a>
<a href=”mailto:support@wordpressapi.com/files/”><img src=”http://www.wordpress.com/wp-content/uploads/2009/07/email_48x48.png” /></a>
<a href=”http://images.wordpressapi.com/feed/”><img src=”http://images.wordpressapi.com/rss_48x48.png” /></a>

Then just change the URLs so that they point to your icons and links. As you can see,

I have four icons in my sidebar (twitter, facebook, email, and rss).

Trick or hack for improving the WordPress site's performance.

Please use this tricks carefuly because First trick will cause issue to your wordpress site.

First Trick
Improve the  wordpress Blog’s Loading Speed

WordPress, by default, comes uncompressed and sends the uncompressed HTML to the visitor’s browser.
Create one file called “phpinfo.php” and then upload it to the root of your blog directory:

In phpinfo.php fine copy paste following code.

<?php phpinfo(); ?>

Check on server zlib is enabled or not.

Copy paste the following code in to your header.php file above the Doctype tag.

<?php
ini_set(‘zlib.output_compression’, ‘On’);
ini_set(‘zlib.output_compression_level’, ‘1’);
?>

This trick will improve your speed upto 50%.

Code taken from following link :
http://www.wprecipes.com/compress-wordpress-output-and-speed-your-blogs-load-speed

wordpress-performance

Second Trick

Allow More Time For Slow Servers to Upgrade WordPress

Open the wp-admin/includes/files.php file and go to line 448.

For WordPressMU users path is wp-admin/includes/file.php and line no 450.

Find this line
$response = wp_remote_get($url, array(‘timeout’ => 60));

replace with

$response = wp_remote_get($url, array(‘timeout’ => 120));

This will change the server response time to 120 second.

Code taken from following link :
http://www.wprecipes.com/wordpress-upgrade-allow-more-time-for-slow-servers

1000 free social networking vector icons

I found very useful links to find and download the social networking icons. In every website we required the social icons and vector images for using the site. I collected some we nice collection of social icons links.

There are indeed free high-quality icon sets. Through icons we can check the web designers and graphic artist’s skill.

socialmedia600

http://www.thedesigncubicle.com/2009/04/600-free-design-twitter-and-social-media-icons-a-collection-motherload/

http://sherifabdou.com/2009/03/60-free-vectors-icons-for-web-designers/

http://www.blogreign.com/2009/06/16-sets-amazing-social-networking-icons-free-download/

http://webtreats.mysitemyway.com/154-free-glassy-space-social-networking-icons/

http://sherifabdou.com/2009/03/60-free-vectors-icons-for-web-designers/

http://digg.com/design/Free_Social_Network_Icons

http://designreviver.com/freebies/6-free-new-social-icons-digg-twitter-stumble-rss-delicious-reddit/

http://www.komodomedia.com/blog/2009/06/social-network-icon-pack/

http://www.smashingmagazine.com/2008/03/06/35-really-incredible-free-icon-sets/

I searched for facebook, twitter, feedburner, digg.

How to show tweetmeme button and facebook share button with the_excerpt function.

I created custom wordpress theme. In that theme I am using the_excerpt method for showing the post on some pages.
I installed the tweetmeme and facebook-share-new plugins and activated on wordpress site.
I saw one issue with these plugins. These plugins are showing on only single pages or posts.

facebook-twitter

Facebook and twitter button are not showing when I am using the the_excerpt() function.

I tried google but I did not got any suaitable answer. Everybody is saying about do mannual work when we creating the post.

So did checked the these plugins and I found the solution.

First I am taking about tweetmeme plugin. I opened the “tweetmeme.php” file. This file you will find in wordpress plugins and tweetmeme folder.

Add following code to line no 721 and comment the following line.

add_filter(‘the_excerpt’, ‘tm_update’);
//add_filter(‘get_the_excerpt’, ‘tm_remove_filter’, 9);

Add following code to line no 129
remove_action(‘the_excerpt’, ‘tm_update’);
tweetmeme
When you done with changes you will be able to see tweetmeme button with wordpress post excerpt also.

Updated tweetmeme.php file you can download from here. Please right click and choose save as option.

Now I am going to talk about facebookshare plugin. I opened the facebookshare.php file. This file you will find in wordpress plugins facebook-share-new folder.

Add following code to line no 843

add_filter(‘the_excerpt’, ‘fb_share’);

When you done with changes you will be able to see facebookshare button with wordpress post excerpt also.

Updated facebookshare.php file you can download from here. Please right click and choose save as option.

457 Free WordPress Themes (amazing, excellent, High quality, Fresh,First class, beautiful, artistic,elegant, fresh-usable,clean)

I searched on smashingmagzine site I found about 457 wordpress themes. which all are choosen and good. URLs for as follows:

http://www.smashingmagazine.com/2009/05/18/100-amazing-free-wordpress-themes-for-2009/

http://www.smashingmagazine.com/2008/01/08/100-excellent-free-high-quality-wordpress-themes/

http://www.smashingmagazine.com/2009/11/12/40-free-high-quality-wordpress-themes/

http://www.smashingmagazine.com/2007/03/29/8-fresh-and-clean-wordpress-themes/

http://www.smashingmagazine.com/2008/03/25/15-more-free-first-class-wordpress-themes/

http://www.smashingmagazine.com/2008/08/25/30-free-high-quality-wordpress-themes/

http://www.smashingmagazine.com/2007/02/09/83-beautiful-wordpress-themes-you-probably-havent-seen/

http://www.smashingmagazine.com/2007/08/28/45-excellent-blog-designs/

http://www.smashingmagazine.com/2007/06/26/21-fresh-usable-and-elegant-wordpress-themes/

http://www.smashingmagazine.com/2007/05/07/10-fresh-elegant-and-clean-wordpress-themes/

wordpress-logo-shine

Have fun!

How to add www to domain name through apache or htaccess

Just use following code in apache configuration file or .htaccess file.

If you are using the shared hosting then please go with only .htaccess file.

Just copy paste following code in .htaccess file.

<IfModule mod_rewrite.c>

Options +FollowSymlinks

RewriteEngine On

RewriteBase /

RewriteCond %{HTTP_HOST} !^www\.wordpressapi\.com$ [NC]

RewriteRule ^(.*)$ http://www.wordpressapi.com/files/$1 [L,R=301]

</IfModule>

How to check iframes are loaded completely in browser

How to check iframes are loaded completely in browser

Many times we use the iframes in site for loading the some extra content. Some time we need trigger events when iframes are loaded on webpage.

In webpage loading Iframe and controlling site UI is very important.

This script is able to check local or cross domain iframe is loaded or not.

I tested following script with various browsers and OS. So there is no cross browser issue.


<script type="javascript"></p>
var iframe = document.createElement("iframe");
iframe.src = "http://wordpressapi.com/";
if (navigator.userAgent.indexOf("MSIE") > -1 && !window.opera){
iframe.onreadystatechange = function(){
if (iframe.readyState == "complete"){

alert("Iframe is now loaded.");
}
};
} else {
iframe.onload = function(){

alert("Iframe is now loaded.");
};
}

</script>
How to check iframes are loaded completely in browser

How to check iframes are loaded completely in browser

Have fun!

Solved: header function issue with WordPress

If you are faceing issue with redirecting the one page or post to another page.

All PHP programmer always first try header() function. But when you use header function in worpdress that will not allow you to redirect the page.

Instead of using the header function please use wp_redirect() function which is provided by WordPress API.

<?php

global $post; // if outside the loop

if ( is_page() && $post->post_parent ) {

// This is a subpage

wp_redirect(get_option(‘siteurl’) . ‘/wp-login.php’);

} else {

// This is not a subpage

wp_redirect(get_option(‘siteurl’) . ‘/wp-login.php’);

}

?>

Use following URLs for reference.

http://codex.wordpress.org/Conditional_Tags

http://codex.wordpress.org/Function_Reference/wp_redirect