• I’m running WP 3.0.1 with multisites and I want to know if it’s possible (by plugin or code) for the site generator to add the same pages that are on the main account to every site created. Right now it only has an option to add a first page and a first post. I want it to add multiple pages. Thanks

Viewing 12 replies - 1 through 12 (of 12 total)
  • Thread Starter javigh123

    (@javigh123)

    No, that doesn’t do what I’m looking for. Lets say for example that on my main site, http://www.mysite.com (that’s where the wordpress installation is located) i have 6 pages. Well, when I create a new site using multisite, i want those same pages to be created on the new site.

    On the wp-admin/ms-options.php file I added new input fields for page 2 page 3 etc and on wp-admin/includes/upgrade.php I added new lines to create those pages. but when I enter what i want for page 2 page 3 etc in the options menu of multisites and I click the save button, that information is not being saved or displayed on the new site once it’s created.

    Yes, I know exactly what you want. I keep forgetting the plugin doesn’t add extra pages. It add all kinds of *other* stuff though.

    http://wordpress.org/support/topic/how-to-change-about-and-create-set-pages-for-all-new-multisites?replies=6#post-1585924

    Thread Starter javigh123

    (@javigh123)

    Do i need to change anything specific on that file for it to read from ms-options.php?

    I can get it to create new pages, that’s no problem, but i want to put content in the input box of the “options” in the super admin.

    this is the second page i created:

    // Health Product Kits Page
    $second_page = __(‘This is the health product kits page’);
    if ( is_multisite() )
    $second_page = get_site_option( ‘second_page’, $second_page );
    $second_post_guid = get_option(‘home’) . ‘/?page_id=3’;
    $wpdb->insert( $wpdb->posts, array(
    ‘post_author’ => $user_id,
    ‘post_date’ => $now,
    ‘post_date_gmt’ => $now_gmt,
    ‘post_content’ => $second_page,
    ‘post_excerpt’ => ”,
    ‘post_title’ => __(‘Health Product Kits’),
    /* translators: Default page slug */
    ‘post_name’ => _x(‘health product kits’, ‘Default page slug’),
    ‘post_modified’ => $now,
    ‘post_modified_gmt’ => $now_gmt,
    ‘guid’ => $second_post_guid,
    ‘post_type’ => ‘page’,
    ‘to_ping’ => ”,
    ‘pinged’ => ”,
    ‘post_content_filtered’ => ”
    ));
    $wpdb->insert( $wpdb->postmeta, array( ‘post_id’ => 3, ‘meta_key’ => ‘_wp_page_template’, ‘meta_value’ => ‘default’ ) );

    That page will only display “This is the health product kits page” as if it wont go to the next line where the conditional satement tells it if its part of a multisite, display the variable that was inputed from the options page.

    Thread Starter javigh123

    (@javigh123)

    ok, i finally figured it out and this is what you have to do to add more default pages in the “options” section of multisites. I am running WP 3.0.1 on php5

    open the following 3 files in your editor, I like using Zend because it notifies you when you have broken code.

    root/wp-admin/ms-options.php
    root/wp-admin/ms-edit.php
    root/wp-admin/includes/upgrade.php

    in ms-options.php go down to about line 220 and copy the <tr> code that creates the input box of the first page (about page). Now paste it right below the </tr> meaning it’s going to start a new table row. Change the variables from first_page to second_page (or whatever you want to, just remember to keep this consistent. throughout all 3 documents you are editing. Add as many of these as you like and change the variables of each.

    Now on the ms-edit.php go down to around line 120 and you will see a line that starts off with $options = array. You will see a bunch of variables there, look for ‘first_page’, and add as many pages as you added in the ms-options.php file. for example, if you added 2 more pages you will add ‘second_page’, ‘third_page’, (or whatever you named them). Make sure there is a space between each.

    Last file to edit is upgrade.php. Go down to around line 255 and you will see a line that starts off $first_page = _(‘This is the first page’). Copy that line all the way down to the last line that starts off with $wpdb->insert…….
    Paste what you copied below this line and you will have to change everything from $first_page to $second_page (or whatever you named it) Remember everything has to be consistent or it will not work. One of those options is ‘post_title’ => _ (‘About’), this is where you change the title “About” of your first page. Add as many of these as you created in the ms-options.php file

    This is not hard at all to do, I have very basic php skill and I was able to figure it out. The hardest part is finding out which is the first document you need to edit and I did that for you. Happy php’n!

    Thread Starter javigh123

    (@javigh123)

    PS. if you want to create static pages for each new site, you just have to edit the wp-admin/includes/upgrade.php file (in my case i needed to change different pages i created so i had to edit all 3 documents)

    Go down to around line 255 and you will see a line that starts off $first_page = _(‘This is the first page’). Copy that line all the way down to the last line that starts off with $wpdb->insert…….
    Paste what you copied below this line and you will have to change everything from $first_page to $second_page

    replace ‘This is the first page’ with whatever content you want. Every time you create a site, this is what you will get. Remember to leave the single quotes in place.

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    You should consider plugin-izing that πŸ™‚ I think a lot of people would find it useful.

    Thread Starter javigh123

    (@javigh123)

    Thanks, but my php skills are very limited. I wouldn’t know where to start but I might look into it. can’t learn without trying!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    I’d start with downloading http://wordpress.org/extend/plugins/wpmu-new-blog-defaults/ and sorting out what it does πŸ™‚ Which is how I got started making plugins πŸ™‚ MUCH better than hacking core (which you will have to do every time you update).

    Thread Starter javigh123

    (@javigh123)

    yea that’s what i’m afraid of, everytime i update its going to break….thanks for the tip.

    Hey there, Did you manage to get this working with that plugin Ipstenu mentioned? i need to do exactly the same thing for a system i am creating, but not just create pages, set the default homepage as one of those pages.
    It needs to work, so when in network admin, “add new” will auto setup that blog with settings and pages…

    We also need to edit the new admin users permission to NOT be able to access admin CP settings….

    Im using multisite-enable to manage the multi sites…

    Thanks!

    Moderator Ipstenu (Mika Epstein)

    (@ipstenu)

    πŸ³οΈβ€πŸŒˆ Advisor and Activist

    We also need to edit the new admin users permission to NOT be able to access admin CP settings….

    Then what’s the point of making them admins at all? Or even having the site… What you just said (though likely not what you meant) is that you want to make people a site where they can’t get into the back end and add pages etc.

    This is an old topic, though. Please make a new one and outline what you’re doing. The plugin I mentioned WILL make pages, and set the first post. You MAY be asking how to default it to a STATIC front page, which is possible, but you’ll need to be more specific πŸ™‚

    Also take the time to explain what you mean by ‘not access the admin CP settings’. You mean the WP control panel (We call it a dashboard) or something else?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘Add Multiple Pages on WP Multisite by default’ is closed to new replies.