<?php $layout = smallbiz_get_current_layout(); ?> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml" <?php language_attributes(); ?> > <head> <!--Expand2Web SmallBiz Version 3.7.4a--> <meta http-equiv="Content-Type" content="<?php bloginfo('html_type'); ?> ; charset=<?php bloginfo('charset'); ?> " /> <?php if (get_option('smallbiz_mobile-layout-enabled') && $GLOBALS["smartphone"]) { ?> <meta name="viewport" content="width=320px; initial-scale=1.0; maximum-scale=1.0; minimum-scale=1.0; user-scalable=0;" /> <?php } else { ?> <meta name="viewport" content="width=980px;user-scalable=1;" /> <?php } ?> <?php
} add_action('wp_loaded', 'smallbiz_setup_mobile'); // include our layout functions if they exist, and set up the layout before we do anything else besides check for mobile: if (smallbiz_get_current_layout() || isset($_POST["layout"])) { $currlayout = smallbiz_get_current_layout(); if (isset($_POST["layout"])) { $currlayout = $_POST["layout"]; } if (!$currlayout) { $currlayout = "classic"; update_option('smallbiz_layout', "classic"); } if (file_exists(TEMPLATEPATH . "/layouts/" . $currlayout . "/functions_layout.php")) { include TEMPLATEPATH . "/layouts/" . $currlayout . "/functions_layout.php"; } if ($currlayout != smallbiz_get_current_layout()) { if (function_exists(smallbiz_defaults_for_layout)) { $layout_opts = smallbiz_defaults_for_layout(); foreach ($layout_opts as $key => $value) { if (!get_option("smallbiz_" . $key)) { add_option("smallbiz_" . $key, $value); update_option("smallbiz_" . $key, $value); } $_POST[$key] = get_option("smallbiz_" . $key); } } else { add_option("smallbiz_layout_title", ""); } } } if (function_exists('register_sidebar')) {
$preview_special = true; } else { if (isset($_REQUEST['contact'])) { include "contact_page.php"; $preview_special = true; } } } } // If we loaded a special page, do nothing. Otherwise... if ($preview_special) { } else { if (is_front_page()) { /* If this is the front page, check if the the homepage is the smallbiz one... */ if (get_option('smallbiz_mobile-layout-enabled') && $GLOBALS["smartphone"] || get_option('smallbiz_page_on_front') == get_option('smallbiz_homepage_id')) { include 'layouts/' . smallbiz_get_current_layout() . '/frontpage.php'; } else { /* ... or if the homepage is set to something else; if so, load that page and display it: */ $id = get_option('smallbiz_page_on_front'); $recent = new WP_Query("page_id={$id}"); while ($recent->have_posts()) { $recent->the_post(); ?> <?php $pageClass = preg_replace("/[^a-z\\d]/i", "", strtolower($recent->post->post_title)); include "page_while.php"; ?> <?php } ?>
<?php // shared functions to help repair things that get broken: $hideSidebar = false; // set from layout when sidebar needs to be hidden $this_id = $wp_query->get_queried_object()->ID; function smallbiz_do_repair() { echo "repair called"; $home_id = smallbiz_get_page_id_by_title_create_if_needed('Home', -5, 'Home ', "index.php"); update_option("smallbiz_page_on_front", $home_id); update_option("page_on_front", $home_id); update_option("smallbiz_homepage_id", $home_id); } if (!smallbiz_get_current_layout()) { update_option('smallbiz_layout', "classic"); } // Repair our home page being deleted or set to an invalid page: if (is_404()) { function smallbiz_preheader_check_homepage_ok() { $checkId = get_option('smallbiz_page_on_front'); // *must* be passed by reference $checkPage = get_page($checkId); if ($checkPage == null || $checkPage->post_status == "trash") { return false; } return true; } if (!smallbiz_preheader_check_homepage_ok()) { smallbiz_do_repair();