'000000', 'text' => 'bfbfbf', 'link' => 'ffffff', 'border' => '000000' ); // this varies but the single page content width seems to be 607px max $content_width = 600; register_sidebar( array( 'name' => __('Bottom 1'), 'id' => 'bottom-1', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __('Bottom 2'), 'id' => 'bottom-2', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); register_sidebar( array( 'name' => __('Bottom 3'), 'id' => 'bottom-3', 'before_widget' => '', 'after_widget' => '', 'before_title' => '

', 'after_title' => '

' ) ); class Hemingway { var $raw_blocks; var $available_blocks; var $style; var $version; function add_available_block($block_name, $block_ref) { $blocks = $this->available_blocks; if (!$blocks[$block_ref]){ $blocks[$block_ref] = $block_name; update_option('hem_available_blocks', $blocks); wp_cache_flush(); } } function get_available_blocks() // This function returns an array of available blocks // in the format of $arr[block_ref] = block_name { $this->available_blocks = get_option('hem_available_blocks'); return $this->available_blocks; } function get_block_contents($block_place) // Returns an array of block_refs in specififed block { if (!$this->raw_blocks){ $this->raw_blocks = get_option('hem_blocks'); } return $this->raw_blocks[$block_place]; } function add_block_to_place($block_place, $block_ref) { $block_contents = $this->get_block_contents($block_place); if (in_array($block_ref, $block_contents)) return true; $block_contents[] = $block_ref; $this->raw_blocks[$block_place] = $block_contents; update_option('hem_blocks', $this->raw_blocks); wp_cache_flush(); // I was having caching issues return true; } function remove_block_in_place($block_place, $block_ref) { $block_contents = $this->get_block_contents($block_place); if (!in_array($block_ref, $block_contents)) return true; $key = array_search($block_ref, $block_contents); unset($block_contents[$key]); $this->raw_blocks[$block_place] = $block_contents; update_option('hem_blocks', $this->raw_blocks); wp_cache_flush(); // I was having caching issues return true; } // Templating functions function get_block_output($block_place) { $blocks = $this->get_block_contents($block_place); foreach($blocks as $key => $block ){ include (TEMPLATEPATH . '/blocks/' . $block . '.php'); } } function get_style(){ $this->style = get_option('hem_style'); } } $hemingway = new Hemingway(); $hemingway->get_available_blocks(); $hemingway->get_style(); $hemingway->version = "0.13"; // Options $default_blocks = Array( 'recent_entries' => 'Recent Entries', 'about_page' => 'About Page', 'category_listing' => 'Category Listing', 'blogroll' => 'Blogroll', 'pages' => 'Pages', 'monthly_archives' => 'Monthly Archives' ); $default_block_locations = Array( 'block_1' => Array('about_page'), 'block_2' => Array('recent_entries'), 'block_3' => Array('category_listing'), 'block_4' => Array(), 'block_5' => Array(), 'block_6' => Array() ); if (!get_option('hem_version') || get_option('hem_version') < $hemingway->version){ // Hemingway isn't installed, so we'll need to add options if (!get_option('hem_version') ) add_option('hem_version', $hemingway->version, 'Hemingway Version installed'); else update_option('hem_version', $hemingway->version); if (!get_option('hem_available_blocks') ) add_option('hem_available_blocks', $default_blocks, 'A list of available blocks for Hemingway'); if (!get_option('hem_blocks') ) add_option('hem_blocks', $default_block_locations, 'An array of blocks and their contents'); if (!get_option('hem_style') ) add_option('hem_style', '', 'Location of custom style sheet'); } // Ajax Stuff if ($_GET['hem_action'] == 'add_block'){ $block_ref = $_GET['block_ref']; $block_place = $_GET['block_place']; $block_name = $hemingway->available_blocks[$block_ref]; $hemingway->add_block_to_place($block_place, $block_ref); ob_end_clean(); // Kill preceding output $output = ''; echo $output; exit(); // Kill any more output } if ($_GET['hem_action'] == 'remove_block'){ $block_ref = $_GET['block_ref']; $block_place = $_GET['block_place']; $hemingway->remove_block_in_place($block_place, $block_ref); ob_end_clean(); // Kill preceding output $output = ''; echo $output; exit(); // Kill any more output } if ($_POST['custom_styles']){ update_option('hem_style', $_POST['custom_styles']); wp_cache_flush(); $message = 'Styles updated!'; } if ($_POST['block_ref']){ $hemingway->add_available_block($_POST['display_name'], $_POST['block_ref']); $hemingway->get_available_blocks(); $message = 'Block added!'; } // Stuff add_action ('admin_menu', 'hemingway_menu'); $hem_loc = '../themes/' . basename(dirname($file)); function hemingway_scripts() { $dir = get_bloginfo('template_directory'); wp_enqueue_script('prototype'); wp_enqueue_script('dragdrop', $dir . '/admin/js/dragdrop.js', false, 1); wp_enqueue_script('effects', $dir . '/admin/js/effects.js', false, 1); } function hemingway_menu() { $page = add_submenu_page('themes.php', 'Hemingway Options', 'Hemingway Options', 5, $hem_loc . 'functions.php', 'menu'); add_action('load-' . $page, 'hemingway_scripts'); } function menu() { global $hem_loc, $hemingway, $message; ?>

Color Options

Choose a primary color for your site:

Hemingway's Bottombar™

Drag and drop the different blocks into their place below. After you drag the block to the area, it will update with the new contents automatically.

*Note: Widgets take prefernce over these blocks.

read()) !== false) { if (!preg_match('|^\.+$|', $file) && preg_match('|\.php$|', $file)) $blocks_files[] = $file; } } if ($blocks_dir || $blocks_files) { foreach($blocks_files as $blocks_file) { $block_ref = preg_replace('/\.php/', '', $blocks_file); if (!array_key_exists($block_ref, $hemingway->available_blocks)){ ?>

You have uninstalled blocks!

Give the block a display name (such as "About Page")

: