How to minify JavaScript and CSS files

Larger js and css files waste not only your bandwidth, but also your visitors’ time, so it’s win-win to minify them.

There’re 2 ways to minify a file, the first is to reduce the content length, like removing useless content, and the other is to deliver a compressed version, which is very effective for text content. We can use them both on js and css files.

1. Reduce the content length

The simplest way is using some online tools,

If you are familiar with css and js, you could optimize the code at first:

  • Remove the css rules and js functions that are not actually used anywhere.
  • Simplify code:
    • For css, you might see such rules: .class #id { // some rules } , does #id{// some rules} works the same way?
    • For js, you might see: var a=1; var b=2; , this can be simplified as var a=1,b=2.

(continue reading…)


Optimize cache-control to speed up page loading

Nowadays, web page is not just plain text, besides images and flash, it also contains external css and script, loading a page means loading all these stuff. For the pages on the same site, some stuff might be commonly used, like css, in such case, the browser would just load it once, then store it on the load disk as cache. Reading from cache is much much faster than loading from a remote server, in the best case, everything is cached, then the page’s loading time will be zero.

So what is cache-control? It’s something for the browser, telling an expire time for the cached stuff, after that time, the cache will not be used, but to reload again from server. The expire time depends on how long the file is changed, for example, the css file, normally you won’t change what your site looks like every day, right? So, it’s reasonable to make it expire in a week.

(continue reading…)


Does your WP theme need jQuery? Load it from Google!

jQuery is used a lot to make effects, like dropping down a menu. WP theme developers choose jQuery not only because it’s popular, but also because it comes together with WordPress, just in the wp-includes/js/jquery folder, WordPress uses it widely in the admin panel. So just check the home page source,  if you can find ‘/wp-includes/js/jquery/jquery.js’, then your wp theme needs jQuery.

jQuery is a big library, over 50K normally, loading it from somewhere else not only saves your bandwidth, but also increases the page speed, as normally the brower won’t generate too many requests to the same sever at the same time. And even better, this “somewhere else” is Google, which is fast and stable!

Here it is, the latest jQuery from Google:

http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js

here is the documents.

(continue reading…)


How to remove the WordPress “generator”

Have your ever seen this line in the source code?

<meta name="generator" content="WordPress *.*.*" />

There are several reasons for WordPress to generate this line, but from the user’s point, it’s not a good idea to tell out what system and which version your site is.

To remove the “generator” line, please follow these two steps:

1. Find out what theme you are using, and in that theme folder, find a file named “functions.php”, if you don’t find this file, just create it.

2.Add this line to the end:

remove_action('wp_head', 'wp_generator');

It’s done! Very simple, right?

(continue reading…)


How to host multiple sites with one WordPress

If you have multiple sites on the same server, and all based on WordPress, then it is possible to use just one WordPress folder.

Here is what you need to do:

1.Copy all plugins and themes to the WP folder, make sure it has all the extensions all sites need.

2.Store settings separately.

The settings means everything you can config via the wp-admin control panel, not only WP-self settings, but also plugins and themes settings.

WP-self settings all stored in the database, we are sure about this.

Plugins and Themes settings, on the other hand, not that sure. Some plugins will write something to a file in the wp-content folder,  and it’s possible that the same file was used for different sites, that’ll cause conflicts. It’s supposed to make the domain name as part of the file name, just like what wp-super-cache does: generating a top folder with the same name as domain name. If you don’t find any file been generated, or  the files are well separated due to different domains, then you go to the final step.

(continue reading…)

1 Comment more...

How to hide that your site is using WordPress

WordPress is open source, but that doesn’t mean it’s 100% safe, if some security vulnerabilities were discovered,  then disclosing that you are using that version almost means everybody could hack your site. So, it’s the best to hide the WordPress iden tag and the version number(especially).

1.Remove “readme.html” in the root folder.

readme.html is a common file with WP package, just to answer some basic questions, like how to install WordPress. You can visit “yourdomain/readme.html” to check that. This file contains the WordPress tag and version number, so you should rename this file or just remove it.

(continue reading…)


How to protect the wp-content folder of WordPress

wp-content folder contains WordPress themes and plugins, or we just call them extensions, which makes your WordPress different from others. More or less, we all need to install some to enhance our WordPress system, just like we install softwares on our OS, but it also bring risks.

Do not install any untrust extension unless you know exactly what it’s doing.

We all heard about viruses and trojans, right? Although WP extensions are open source, people might not take the time to read the code line by line. On the other hand, writing secure code is a skill not every developer learns that well, it’s possible that an useful plugin become a backdoor for hackers. So, be careful to install something new.

Rename wp-content folder

I think WP should make this step a mandatory one at the beginning, and it’s also helpful for hiding that your system is WordPress.

Before renaming the wp-content folder, I should tell that some plugins and themes use “wp-content” directly in the code, which is not supposed.  In such cases, these extensions should be fixed at first( WP Widget Cache fix this in version 0.25.3), using WP_CONTENT_DIR or WP_CONTENT_URL insteadly.

Open the wp-config.php file in the root folder, and add these lines before this: require_once(ABSPATH . ‘wp-settings.php’), (normally the last line)


define('WP_CONTENT_FOLDERNAME', 'your-content');

define('WP_CONTENT_DIR', ABSPATH . WP_CONTENT_FOLDERNAME );
define('WP_CONTENT_URL', 'http://your-domain/'.WP_CONTENT_FOLDERNAME);

define('WP_PLUGIN_DIR', WP_CONTENT_DIR . '/plugins' );
define('WP_PLUGIN_URL', WP_CONTENT_URL.'/plugins');

Replace your-content with a new name you like, and replace your-domain with your site domain, then, you can rename “wp-content” folder to the new name.


WP Widget Cache ChangeLog

Download

Plugin Homepage

**Version 0.25.4**

Fix a bug that using the same cache with multiple sites (Thanks Zsolt Lakatos)

**Version 0.25.3**

Fix a bug to use “wp-content” directly as the cache dir

**Version 0.25.2**

Some changes with the cache clear method

Remove cache func when get option, that’s really not necessary

(continue reading…)


WP Widget Cache For WordPress

A high-performance cache plugin for WordPress, and a plus for WP-Cache or WP Super Cache !

Download

ChangeLog

Why we need this WP Widget Cache?

WP Widget Cache can cache the output of your blog widgets. Usually it will significantly reduce the SQL queries to your database and speed up your site.

I think you’ve heard of WP-Cache or WP Super Cache, they are both top plugins for WordPress, which make your site much faster and responsive. Here is how cache works:

“caching WordPress pages and storing them in a static file for serving future requests directly from the file rather than loading and compiling the whole PHP code and the building the page from the database”.

If your site get a very high traffic, or you blog are hosted on a shared server, you do need cache. If you use widgets, you do need WP Widget Cache.

(continue reading…)


  • Categories

  • Recent Comments

    • Andy:Hi Tim, Thanks for telling me this, the issue will be fixed in the next version.
    • Tim:Hey Andrew, i found a small bug. If you clear the Caches in the WordPress.
    • Andy:It’s a runtime error, please check the folder wp-content/wcache.
    • 008:Fatal error: Cache file not writeable! in /home/******/public_html/wp-content/plugins/wp-widget-cache/inc/wcache.class.php...
    • Joel:It is just what I want! Thanks, Andy!
    • arquigrafico:I was looking for a plugin like this, I had to take off severals widgets.
    • Michael:Hi,does 'wp widget cache' works with 'hyper cache'?Michael
  • Copyright © 2010 NexWP. All rights reserved.
    iDream theme by Templates Next | Powered by WordPress