Index: trunk/include/xpress_block_render.php
===================================================================
--- trunk/include/xpress_block_render.php	(revision 44)
+++ trunk/include/xpress_block_render.php	(revision 46)
@@ -38,16 +38,22 @@
 	function get_xpress_theme_name($mydirname)
 	{
-		$xoopsDB =& Database::getInstance();
-		$wp_prefix = $mydirname;
-		if ($wp_prefix == 'wordpress') $wp_prefix = 'wp';
+		global $wpdb;
+		
+		if (is_null($wpdb)){
+			$xoopsDB =& Database::getInstance();
+			$wp_prefix = $mydirname;
+			if ($wp_prefix == 'wordpress') $wp_prefix = 'wp';
 
-		$module_tbl = $xoopsDB->prefix($wp_prefix).'_options';	
-		$theme_name = '';	
+			$module_tbl = $xoopsDB->prefix($wp_prefix).'_options';	
+			$theme_name = '';	
 
-		$sql = "SELECT option_value FROM $module_tbl WHERE option_name LIKE 'template'";
-		$result =  $xoopsDB->query($sql, 0, 0);
-		if ($xoopsDB->getRowsNum($result)  > 0){
-			$row = $xoopsDB->fetchArray($result);
-			$theme_name = $row['option_value'];
+			$sql = "SELECT option_value FROM $module_tbl WHERE option_name LIKE 'template'";
+			$result =  $xoopsDB->query($sql, 0, 0);
+			if ($xoopsDB->getRowsNum($result)  > 0){
+				$row = $xoopsDB->fetchArray($result);
+				$theme_name = $row['option_value'];
+			}
+		} else {
+			$theme_name = get_option('template');
 		}
 		return $theme_name;
@@ -106,6 +112,7 @@
 			require_once $block_theme_file;
 			$block = $call_theme_function_name($options);		//The block name and the called function name should be assumed to be the same name. 
-			
-			xpress_block_cache_write($mydirname,$cache_title. $blockID, $block);
+
+// Not Cache Write Now.  Becose Cache Write On WordPress Event			
+//			xpress_block_cache_write($mydirname,$cache_title. $blockID, $block);  
 		} else {
 			$block = xpress_block_cache_read($mydirname,$cache_title. $blockID);
