jgz compression of js and css using .htaccess

add this code to your .htaccess file

RewriteEngine on
RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.jgz -f
RewriteRule (.*)\.js$ $1\.js.jgz [L]
AddType “text/javascript” .js.jgz
AddEncoding gzip .jgz

RewriteCond %{HTTP:Accept-Encoding} gzip
RewriteCond %{REQUEST_FILENAME}.jgz -f
RewriteRule (.*)\.css$ $1\.css.jgz [L]
AddType “text/css” .css.jgz
AddEncoding gzip .jgz
Options -Indexes

Create A Loop Of Images

To create our loop of images, we first need a PHP function that can grab the first image from each post and return its URL. To do this, paste the following function in your functions.php file. Don’t forget to define a default image on line 10.

 

function catch_that_image() {
  global $post, $posts;
  $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)){ //Defines a default image
    $first_img = "/images/default.jpg";
  }
  return $first_img;
}

Once you’ve saved the functions.php file, you are now ready to display your image loop.


<?php
if (have_posts()) :
    while (have_posts()) : the_post(); ?>
        <a href="<?php the_permalink();?>" title="<?php the_title(); ?>">
        <img src="http://media.smashingmagazine.com/wp-content/uploads/images/wordpress-loop-hacks/<?php echo catch_that_image() ?>" alt="<?php the_title(); ?>" />
        </a>
    endwhile;
endif;
?>

Use More Than One Loop On A Page, Without Printing Duplicate Posts

Let’s start with the first loop. Nothing hard here: we’re just going to get the eight most recent posts using the showposts parameter. Open the index.php file, and paste the following code to output your “featured” posts:

  1. <?php
    query_posts('showposts=8');
    $ids = array();
    while (have_posts()) : the_post();
    $ids[] = get_the_ID();
    the_title();
    the_content();
    endwhile;
    ?>

    Once that’s done, it’s time to apply our second loop and get all posts, excepted the ones we have already outputted in the first loop:

    1. <?php
      query_posts(array('post__not_in' => $ids));
      while (have_posts()) : the_post();
      the_title();
      the_content();
      endwhile;
      ?>
      
      

change wp location

UPDATE wp_options SET option_value = replace(option_value, ‘http://shell-6/iec’, ‘http://shell-14/iec’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;

UPDATE wp_posts SET guid = replace(guid, ‘http://shell-6/iec’, ‘http://shell-14/iec’);

UPDATE wp_posts SET post_content = replace(post_content, ‘http://shell-6/iec’, ‘http://shell-14/iec’);