function smallbiz_setup_menu_pages()
{
    $home_id = smallbiz_get_page_id_by_title_create_if_needed('Home', -5, 'Home ', "index.php");
    if (!get_option("smallbiz_page_for_posts")) {
        if (get_option("smallbiz_page_for_posts_created")) {
            $blog_id = smallbiz_get_page_id_by_title('Blog', 40, 'To add blog posts click on Posts - Add New in the WordPress Dashboard', "posts.php");
        } else {
            $blog_id = smallbiz_get_page_id_by_title_create_if_needed('Blog', 40, 'To add blog posts click on Posts - Add New in the WordPress Dashboard', "posts.php");
            update_option("smallbiz_page_for_posts_created", "true");
        }
    } else {
        $blog_id = get_option("smallbiz_page_for_posts");
    }
    // page stuff:
    if (get_option("show_on_front") != "page") {
        update_option("show_on_front", "page");
    }
    // If they've changed this, change it back... and store their pick in our system.
    if (get_option("page_on_front") != $home_id && get_option("page_on_front") != 0) {
        update_option("smallbiz_page_on_front", get_option("page_on_front"));
        update_option("page_on_front", $home_id);
    } else {
        if (get_option("page_on_front") == 0 || isset($_REQUEST["page_on_front"]) && $_REQUEST["page_on_front"] == $home_id) {
            update_option("smallbiz_page_on_front", $home_id);
            update_option("page_on_front", $home_id);
        }
    }
    if ($blog_id != false) {
        // Update our verion of the blog page:
        if (get_option("page_for_posts") && get_option("smallbiz_page_for_posts") != get_option("page_for_posts")) {
            update_option("smallbiz_page_for_posts", get_option("page_for_posts"));
            $blog_id = get_option("smallbiz_page_for_posts");
        }
    }
    //if(get_option("page_for_posts") != $blog_id){
    if (get_option("page_for_posts") != 0 && $blog_id) {
        //update_option("smallbiz_page_for_posts",get_option("page_for_posts"));
        update_option("page_for_posts", $blog_id);
    }
    add_option('smallbiz_homepage_id', $home_id);
    add_option('smallbiz_added_menu_pages', "true");
}
示例#2
0
/**
 * SmallBiz default page theme. Drawing the page/post contents is done in page_while.php.
 *
 * @package WordPress
 * @subpackage Expand2Web SmallBiz
 * @since Expand2Web SmallBiz 3.3
 */
$hideSidebar = false;
// set from layout when sidebar needs to be hidden
if (!smallbiz_get_current_layout()) {
    update_option('smallbiz_layout', "classic");
}
// Repair our home page being deleted or set to an invalid page:
if (is_front_page()) {
    if ($this_id != get_option('smallbiz_page_on_front') && $this_id != get_option('smallbiz_homepage_id')) {
        $home_id = smallbiz_get_page_id_by_title('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 we have a custom homepage, the "active page" may be incorrect -- so load a different template instead:
$real_template = get_post_meta($real_id, '_wp_page_template', true);
$loaded_template = false;
if (is_front_page() && (get_option('smallbiz_mobile-layout-enabled') && $GLOBALS["smartphone"])) {
    // Don't try to load another template if this is the mobile front page.
} else {
    if (is_front_page() && $wp_query->get_queried_object()->ID != get_option('smallbiz_page_on_front')) {
        $real_id = get_option('smallbiz_page_on_front');
        $real_template = get_post_meta($real_id, '_wp_page_template', true);
        if ($real_template && $real_template != "default") {
示例#3
0
function smallbiz_setup_menu_pages()
{
    $home_id = smallbiz_get_page_id_by_title_create_if_needed('Home', -5, 'Please visit the SmallBiz Options Panel, open the "Layouts" section and select "SmallBiz" under the "Custom Homepage" selector drop down menu. Alternatively you can select any of your other pages as homepage.', "index.php");
    if (!get_option("smallbiz_page_for_posts")) {
        if (get_option("smallbiz_page_for_posts_created")) {
            $blog_id = smallbiz_get_page_id_by_title('Blog', 40, 'To add blog posts click on Posts - Add New in the Worpdpress Dashboard', "posts.php");
        } else {
            $blog_id = smallbiz_get_page_id_by_title_create_if_needed('Blog', 40, 'To add blog posts click on Posts - Add New in the Worpdpress Dashboard', "posts.php");
            update_option("smallbiz_page_for_posts_created", "true");
        }
    } else {
        $blog_id = get_option("smallbiz_page_for_posts");
    }
    // page stuff:
    if (get_option("show_on_front") != "page") {
        update_option("show_on_front", "page");
    }
    // If they've changed this, change it back... and store their pick in our system.
    if (get_option("page_on_front") != $home_id && get_option("page_on_front") != 0) {
        update_option("smallbiz_page_on_front", get_option("page_on_front"));
        update_option("page_on_front", $home_id);
    } else {
        if (get_option("page_on_front") == 0 || isset($_REQUEST["page_on_front"]) && $_REQUEST["page_on_front"] == $home_id) {
            update_option("smallbiz_page_on_front", $home_id);
            update_option("page_on_front", $home_id);
        }
    }
    if ($blog_id != false) {
        // Update our verion of the blog page:
        if (get_option("page_for_posts") && get_option("smallbiz_page_for_posts") != get_option("page_for_posts")) {
            update_option("smallbiz_page_for_posts", get_option("page_for_posts"));
            $blog_id = get_option("smallbiz_page_for_posts");
        }
    }
    //if(get_option("page_for_posts") != $blog_id){
    if (get_option("page_for_posts") != 0 && $blog_id) {
        //update_option("smallbiz_page_for_posts",get_option("page_for_posts"));
        update_option("page_for_posts", $blog_id);
    }
    add_option('smallbiz_homepage_id', $home_id);
    add_option('smallbiz_added_menu_pages', "true");
}