Secure Your Wordpress Installation

Very nice presentation @ Wordcamp NYC this year on Wordpress Security.

Slides: http://www.slideshare.net/williamsba/wordpress-security-updated

Video on Vimeo: http://www.vimeo.com/7685380

Also upgrade your blog as soon as new version comes out.

Can we say now “Hack it if you can!”?

Wordpress MU Site Upgrade Bug: Your server may not be able to connect to blogs running on it

I was upgrading mu site to 2.8.4. I went to Site Admin -> Upgrade and hit Upgrade Site button. It worked for first 25 – 30 blogs and then died with message

Warning! Problem upgrading . Your server may not be able to connect to blogs running on it.
Error message: 200: Operation timed out after 3 seconds with 0 bytes received

This is what I did to fix my problem

I opened wp-admin/wpmu-upgrade-site.php and wp-includes/http.php

function &_getTransport( $args = array() ) {

on line number 94 of wp-includes/http.php, wordpress tests different http request methods exist on your server during upgrade.

1st test was the culprit on my server which uses http_request method built into PHP. I guess this method was taking long time to resolve DNS and so it was timing out.

if ( true === WP_Http_ExtHttp::test($args) ) {
$working_transport['exthttp'] = new WP_Http_ExtHttp();
$blocking_transport[] = &$working_transport['exthttp'];
}

I did comment out this test and let Wordpress start with next one.

if ( true === WP_Http_Curl::test($args) ) {
$working_transport['curl'] = new WP_Http_Curl();
$blocking_transport[] = &$working_transport['curl'];
}

And guess what? All 150 blogs were updated in a few minutes without any problem.

If even curl does not work for you, you can comment it out and move on to the next until WP upgrade site works for you.

Good Luck!

Parent Child Theme – Easiest Way!

This solution will work for you if you want your child theme have fewer templates and if any template is missing, it should not break your blog but should go to parent theme and load it.

And a few important things to set,
1) parent theme folder name
2) child theme folder name
3) Template set in child theme style.css must match parent theme folder name

Because child theme name and Template set in child theme style.css are stored in options table.
(more…)

JSON and Wordpress

If you want to encode/decode JSON within/using wordpress, you can take a look at

/wp-includes/js/tinymce/plugins/spellchecker/classes/utils/JSON.php

This file has Moxiecode_JSON class which can do that for you.
(more…)

Comments Pagination – Wordpress – Bug Fixed!

Actually, I did not create a plugin but I wrote a code snippet that did this job for me.

Add these lines to comments.php in your active theme folder.

$comments_per_page = 5;
global $post;
$total = $post->comment_count;
if($total > 0) {
$apage=isset($_GET['apage']) ? intval($_GET['apage']) : 1;
$comments=array_slice($comments, intval(($apage-1)*$comments_per_page),intval($comments_per_page));
}

Insert this code right after if ($comments) statement

$commentCounter = (($apage-1)*$comments_per_page);
$from_page = $commentCounter+1;
if($apage == 1) {
$to_page = $comments_per_page;
if($total < $to_page) {
$to_page = $total;
}
}
else {
$to_page = $from_page + $comments_per_page - 1;
if($to_page > $total) {
$to_page = $total;
}
}

Insert this line where you want page links to appear in comments.php.

<?php echo paginate_links( array(
'base' => add_query_arg( 'apage', '%#%#comments' ),
'format' => '',
'total' => ceil($total / intval($comments_per_page)),
'current' => $apage
));

I think this is it. It should work. Give it a try and share your feedback via comments.

Google Shared Items in post using shortcode

New in WordPress 2.5 is the Shortcode API, a simple set of functions for creating macro codes for use in post content. I thought let me see how it works! I am showing my google reader shared items within a post using shortcode.

2010: A Theme Odyssey
From: WordPress Development Blog

WordPress 2.9
From: Lester Chan's WordPress Plugins

Create a Simple Slideshow Using MooTools
From: David Walsh :: PHP, CSS, MooTools, jQuery, and Everything Else

Design v5
From: CSS-Tricks

Wordpress 2.5 RC1

Trying a WP 2.5 stable version (2.5-RC1). It’s awesome!

Joomla or Wordpress?

Joomla is primed to be the next favorite Open Source Software, or that it already is? More on WordpressGarage.com

Migrate Tags from UTW Tags to Wordpress 2.3 Terms

I was running wordpress 2.0.5 since 2 years and did not get time to upgrade to Wordpress 2.3.

So I decided last week to upgrade to Wordpress 2.3 and I did. I upgrade the same way how wordpress advice us here.

After installation, I did notice it has migrated my categories tables to wordpress 2.3 Terms tables but nothing migrated from Tags tables. I was surprised! Did I make any mistake? Then it comes into my mind, it is Ultimate Tag Warrior plugin, which has created those tables for me not Wordpress.

Now I had to migrate those tags from Tags table to Terms tables. So I wrote a script that does that job for me. I thought let me make that available to you, if someone would like to extend the script and build a smart plugin! (more…)

Wordpress Database Schema

**Updated**: Wordpress 2.7 Database Schema is now available.
Tired of searching Wordpress Database Schema on Internet? Your search has ended now.

Click here to download wordpress database schema image files.