Error adding theme to WordPress 2.8
I was getting this error:
PHP Fatal error: Call to a member function read() on a non-object in ... \\wp-includes\\theme.php on line 387
Fixed it by editing wp-includes/theme.php, adding ‘is_object’ check at line 387 as follows :
$template_dir = @ dir("$theme_root/$template"); if ( $template_dir ) { while ( ($file = $template_dir->read()) !== false ) { if ( preg_match('|^\.+$|', $file) ) continue; if ( preg_match('|\.php$|', $file) ) { $template_files[] = "$theme_loc/$template/$file"; } elseif ( is_dir("$theme_root/$template/$file") ) { $template_subdir = @ dir("$theme_root/$template/$file"); if ( is_object($template_subdir) ) { while ( ($subfile = $template_subdir->read()) !== false ) { if ( preg_match('|^\.+$|', $subfile) ) continue; if ( preg_match('|\.php$|', $subfile) ) $template_files[] = "$theme_loc/$template/$file/$subfile"; } @ $template_subdir->close(); } } } @ $template_dir->close(); }