phprockers-logo

How To Optimize Your Site With GZIP Compression

0 comments
Compression is a simple, the effective way to save bandwidth and speed up your sites. I hesitated when recommending gzip compression when speeding up your javascript because of problems in older browsers.

Most of my traffic comes from the modern browsers, and quite frankly, most of my users are fairly technology-savvy. I don't want to slow everyone else down because somebody is the chugging along on IE on Windows Operating Systems. Google and Yahoo browsers are using gzip compression.

Before we start, I should explain what content encoding is. When you request a file like http://www.gmail.com/index.html, your browser talks to a web server. 


How to get URL of first image in a post

1 comments

We can easily grab the first image from the post, and display it. 


// Get URL of first image in a post
function get_first_image() {
         global $post;
         $first_img = ''; 
         ob_start();
         ob_end_clean();
         $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $post->post_content, $matches);
         $first_img = $matches [1] [0];
         if(empty($first_img)){
                  $first_image = "/images/default.jpg";
        }
        return $first_image;
}


<?php echo catch_that_image() ?>

How to write a WordPress Plugin?

0 comments
Before we move on coding a plugin, please make sure you remember the following coding practices.

1. Always you chose a unique name to your plugin so that it doesnt collide with names used in other plugins.

2. Make sure you comment wherever and whenever necessary in the code.

3. You will to test the plugin in your localhost (using xampp) along with latest version of wordpress.
Plugin Files & Names

What is mean by Wordpress?

0 comments
WordPress is not just a blogging platform and it is such a powerful CMS with unlimited capabilities, besides having a huge user base. Almost anything can be scripted with wordpress.