WordPress
WordPress tricks and hints, templates, optimization…
Speed up your WordPress II
0In the first part we explained some tricks to make your WordPress faster, but sometimes this is not even enough….we need more speed!
Before I explain more tricks I will like to make a note; I don’t recommend you to change anything from the core of WP. We could make WP much faster by just tweaking a bit the core…but I don’t recommend to you if later you need to upgrade you WP you will lose all that changes!
Then I’m going to focus in tweaking the Theme and usage of some plugins.
- Use less plugins, and remove the tables they are created and no longer are needed
- Get rid off the widget bar and make it static! This will reduce lot of calls to the DB.
- Try to make it everything as static as possible ;)
- Use a CDN, less stress for your server, since will receive less requests. You can use Coral CDN (a bit slow) or Amazon for example.
- Try to use only one CSS and one JS, with w3 total cache this is kind of easy to do.
- Be careful with missing files, if the file doesn’t exist a 404 page returns and needs to be executed :S you can check this here tools.pingdom.com (great tool)
- Erase the comments and use Disqus (export them first, you can use the plugin), this is extremely tweaking, but can be a last solution, I’m not at this point yet but….maybe.
- W3 Total Cache is probably the best cache plugin now a days, give it a try!
And I think that’s all….
Cache up to 30 times faster
2Is not bullshit I swear! Absolutely possible, but you need to be using a VPS or a dedicated server to do this.
This is really handy if you are not using a cache system such as APC or xcache, and you store your cached files in folders.
For this we will use TMPFS
Tmpfs is like a ramdisk, but different. Like a ramdisk, tmpfs can use your RAM, but it can also use your swap devices for storage. And while a traditional ramdisk is a block device and requires a mkfs command of some kind before you can actually use it, tmpfs is a filesystem, not a block device; you just mount it, and it’s there. All in all, this makes tmpfs the niftiest RAM-based filesystem I’ve had the opportunity to meet.
Example to use it in your WordPress:
(check the right paths)
Edit /etc/fstab/ and we add the file system
tmpfs /home/neo22s/wp-content/cache tmpfs defaults,size=2g,noexec,nosuid,uid=648,gid=648,mode=1755 0 0
Add a new line at /etc/rc.local in order to execute it on system start up:
ionice -c3 -n7 nice -n 19 rsync -ahv --stats --delete /_b/tmpfs/cache/ /home/neo22s/wp-content/cache/ 1>/dev/null
New crontab job (using crontab-e), to execute
*/5 * * * * /usr/bin/ionice -c3 -n7 /bin/nice -n 19 /usr/bin/rsync -ah --stats --delete /home/neo22s/wp-content/cache/ /_b/tmpfs/cache/ 1>/dev/null
Done!
Currently I’m not using this method since I have xcache that make my life easier working with w3 total cache plugin, great solution.
Of course you can use TMPFS for many other things, check askapache, where you can find loads of info and examples a great work.
Free CDN Coral
0
For busy websites, using a CDN (Content Delivery Network) to transfer static content such as images, javascripts, stylesheets, Flash etc. is highly recommended (as listed in Yahoo!’s Best Practices for Speeding Up Your Web Site) as it reduces server load and bandwidth thus improves stability and availability.
There’s plenty os commercial CDN’s like Akamai, Limelight, FileCloud, Amazon S3… and as far as I know just an exception, the free P2P-based CoralCDN allows us to take full advantage of a powereful CDN without spending a dime.
How to use it? Well, basically, just append .nyud.net to the hostname of any URL, and that URL will be handled by Coral – simple.
Examples:
http://neo22s.com.nyud.net http://neo22s.com.nyud.net/wp-content/themes/neo-fluid-blue/style.css http://www.coralcdn.org.nyud.net/imgs/logo.jpg
The service works really good as far as I could try, but it’s slow, nothing to compare to Amazon S3 and can help us to prevent hotlinking other sites.
Also we can find a WordPress plugin Free CDN that makes things easier in WP.
Remember another interesting service to cache your images rir.li.
I Love and I Hate WordPress
5
I’ve been using WordPress for over 4 years now. I also have developed some plugins like Twitter Badge, WP-RIR, WP-PageScroll and I wrote few more thinks about it.
We can say that I’m not the average user but neither I’m a PRO developer for WP. The point is that as user I Love WordPress but from other side as technician sometimes I HATE IT.
I had a few discussions with people about the good and the bad things of WP, of course at the end for me it’s positive, but it bothers me that there’s few known issues that they should take care of and they don’t.
Anyway here’s my list with a short description.
The Love
- Easy, yep WP it’s easy and everybody knows how to use it. Great work on it.
- Community, there’s a huge community of developers and designers that releases their work for free making this software good.
- GPL, free software license, what else do you want?
- Custom, it’s pretty easy for any normal user to install plugins, themes…even change them.
- Upgrades and updates, they are automatically making your life easier, same as 1st point.
- WordCamps, this is a great idea I may say and I love it!
The Hate
- Slow, it maybe fast to you, but for me it’s a really heavy application to be a blog software. Without plugins to cache content you can’t run an instance of WP in a shared hosting….
- Data Base, this is terrible, still uses MySam, now many people will say this is an advantage, come on we are in 2010! relational data bases it’s a must have, and what about normalization?
- Download size, now a days this is no trouble, but how can be over 2MB size?
- Bugs, there’s so many WP installations that some people is trying really hard to hack this software and for instance finding bugs. Thankfully we have a great community that seems to work 24/7.
- Plugins, I love the plugins and the work from the community, but you need to be aware what you install in your WP, I know it’s not the fault of WP, but some how as they do with the themes being picky, should be with plugins testing them even just a little bit.
As conclusion I will say that they should focus to improve performance instead of adding features and more and more features….And as I said before WP it’s my favorite blogging and even CMS tool.
Last words: Thanks to the WP team and the community for the work they have done, this is just a constructive opinion meaning the best intentions.
Image from sitepoint.
WP-Rir, Plugin to prevent you to do image hotlinking
2First of all, Merry Xmas!!!
Do you remember rir.li this service to prevent you to do image hotlinking?
To make easier the usage of this service, here you have the plugin for WordPress.
Installation:
- Download
- In your WordPress go to admin Dashboard -> Plugins -> Add new->Upload
- Select the downloaded file
- Activate
- Enjoy ;)
Usage:
Once it’s installed, you can use it to copy any images in the service of rir.li like this:
<rir>http://www.turisbot.com/images/maastricht.jpg</rir>
or
[rir]http://www.turisbot.com/images/maastricht.jpg[/rir]
Twitter Badge for WordPress
15New plugin ;)
Today I’ve made a new plugin to use the Twitter Badge generator easily in your WP.
Features:
- No image or flash for text
- No JavaScript needed
- Link directly to you twitter account!
- You can select background color, text color and your own text
Installation
To install it you can do as any other plugin of WP.
- Upload (you can do it to from the control panel) it to your /wp-content/plugins/ folder and activate it!
- Then you need to configure it
- Check your homepage it will be in the right side
NOTE: Works in Works in FF 3.5, Chromium (No Autoscroll), ie7,ie8, NO IE6.
WP-Datediff – Plugin for WordPress
0Super simple plugin that allow us to know the difference between dates in WP.
What is useful for?
In my case in few blogs I only display advertisements when the post is older than 7 days for example. For this I need to know the difference between dates, in a easy way.
Usage:
To display something (like an ad) depending on a a expiring date:
if (post_is_expired(7)){ echo "display something"; }
As a param we have number of days, by default is 30. Returns true or false if it’s expired or not.
Date difference for a post:
$p_time=datediff_post("2008-01-12","M");
First parameter, date in YYYY-MM-DD format, second parameter can be “D” day , “M” month or “Y” year.
Returns in the specified second parameter an int with the difference.
Install:
- Download
- Go to your WP Dashboard
- Plugins -> Add New -> Upload -> Select the WP-Datediff.zip file
- Activate plugin
- Now, you may want to edit your single.php file form your theme for example to enable the datediff
WordPress as CMS multilingual
8As known for almost all of us WodPress may be one of the best Blogging platform, or the best one ;)
But not that many people is using it as CMS, that will bring us the power of WP (Themes, plugins…)
It’s really easy to do and within few minutes you will have it working and in multi location.
Steps:
- Download the latest version of WP http://wordpress.org/
- Install it
- Add new page called for example Blog (optional, only if you want to use blog)
- Go to Settings -> Reading
- Here where says “Front page displays” select an static page like the Home, or any other page you have created before
- “Posts page:” you can leave it blank as I said or select Blog
Done!
Recommendation:
- In Settings->Permalinks, select some friendly URL and not the numbers
- Change the default theme, it’s really easy from Appearance->Add New Theme
- Speed up your WordPress installation by following this steps
You can’t forget to install this plugins !
(more…)
Open Classifieds for WordPress – wpClassifieds
11Today I’ve just found that there’s a theme made from Open Classifieds that makes your WP behave as OC.
A bit complicated since if you need a Classifieds system why you should install a blog?
But anyway it’s a great work that they have done!
What is it?
wpClassifieds is a free WordPress theme that transform your wordpress blog into a classified ads site similar to Craigslist or OLX based on classifieds ads system Open Classifieds. It is released under a GPL license.
Some features
- - Publish ads without registration
- - Publish ads with pictures
- - Confirm new ads by email
- - Edit ads after publish
- - Unlimited categories and subcategories
- - Translatable theme
- - reCaptcha
- - Akismet
Download
Get the latest version of wpClassifieds (1.2.1) compatible with WordPress 2.8+.
Screenshots
Demo
Visit demo site of wpClassifieds.
Installation
- - Install WordPress.
- - Download wpClassifieds and upload by FTP the folder “wpclassifieds” to your wp-content/themes/ directory.
- - Change folder permissions of the directory “wpclassifieds/includes/cache” to 777.
- - Create a new folder “wpclassifieds” in wp-content/uploads/ y change folder permissions to 777.
- - Activate theme wpClassifieds in your wordpress admin panel.
- - Go to the wpClassifieds Config section.
Support
Please visit the forum.
Custom Error for WordPress
0Tested up to 2.8.5
There’s nothing I do I hate more than finding an error after hours happening.
That was happening in one of my blogs quite often, and I couldn’t trace properly…
This WP hack will allow you to control the 500 error and been notified every time this happens.
How to?
First – Create in the same folder of you theme a file called error.php. In this file I recommend to you to add only HTML code with a friendly error message.
Second – Edit this file in your favorite text editor /wp-includes/wp-db.php
Third – Find this function “function bail($message)”
Fourth – Instead of the current function I recommend to comment the function and paste this (change what’s needed)
function bail($message) { /* custom error page hack shows a custom error page and emails error instead of showing the default wordpress database error page */ include('wp-content/themes/YOUR_THEME_HERE/error.php'); mail('your@email_here.com', 'WordPress Error!', $message); die; /* end custom error page hack */ }
This must be used careful and under your own risk. Also be aware of mass email sending/receiving.



