Title: Static frontpages
Last modified: August 20, 2016

---

# Static frontpages

 *  [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/)
 * Hello everyone,
 * I just reinstalled the latest WP and activated Multisite (sub-domain) after failing
   at something non-important to this issue lol
 * I want the static page I made to show up as default in all new registrated (and
   if possible all old ones too) instead of the blog layout.
 * A user does get the option to change it to a static page, however, the one I 
   created does NOT show in their list when trying to set this (it does show in 
   my own main website optionlist).
 * Anyone can help me with this?
    Thanks in advance!
 * PS. I understand they can make a new Page and select that .php file on the right.
   But I want to disable the option to make new Pages.

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/static-frontpages/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/static-frontpages/page/2/?output_format=md)

 *  Thread Starter [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662233)
 * (unable to edit previous post)
 * I read
    [http://wordpress.org/support/topic/add-multiple-pages-on-wp-multisite-by-default?replies=13](http://wordpress.org/support/topic/add-multiple-pages-on-wp-multisite-by-default?replies=13)
   just now and I understand how I can make static pages for each site.. now I need
   to know how to make 1 Page the default page on all sites.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662244)
 * You’d want to get a plugin like [http://wordpress.org/extend/plugins/wpmu-new-blog-defaults/](http://wordpress.org/extend/plugins/wpmu-new-blog-defaults/)
   for that one.
 *  Thread Starter [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662255)
 * Hey Ipstenu,
 * if you follow the link I provided, you see the same link somewhere there as what
   you just gave me. I understand that plugin just give the site-admins options (
   or removes them).
 * To get a better view of what Im trying to create:
    When a new site-admin is registrated(
   which they can without permission) they get a website like “mysite.example.com”.
   If they visit that URL they get to see “Home” which displays a blog with 1 example
   post in it and an “About Me” Page.
 * I removed some code in wp-admin/includes/upgrade.php to prevent the blog from
   being made by default. So now they only get the “About Me” Page after registrating.
   I also Editted some code in the same file which gives them another Page instead
   of “About Me”.
 * Till now it all worked out. But I dont only want a replacement for “About Me”,
   I want to give that replacement a template (which can normally be set on the 
   right) I created (yes the template works).
 * So what Im guessing is that I need to change this code below to assign a template
   to it:
 *     ```
       // Second Page
       	$second_page = sprintf( __( "" ), admin_url() );
       	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' => __( 'Home' ), // Shows in Menu bar
       								/* translators: Default page slug */
       								'post_name' => __( 'front-page' ), // URL -> example.com/'xxx'/
       								'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' => 'homepage.php' ) );
       ```
   
 * The template name is “homepage.php” and I uploaded it to example.com/wp-content/
   themes/mytheme
 * In the code above I tryed to add it on the bottom (without luck)
    Normally its:`'
   meta_value' => 'default' ) );`
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662259)
 * > I removed some code in wp-admin/includes/upgrade.php to prevent the blog from
   > being made by default.
 * NO! DO NOT DO THAT EVER! Don’t ever ever ever edit core. I’m not kidding.
 * The whole point of using the plugin is to avoid editing core. Which, by the way,
   I categorically refuse to help anyone with on the forums.
 * In the very basic /wp-admin/network/settings.php page, you can customize what
   your initial pages and posts should be.
 * There’s an older plugin, [http://wordpress.org/extend/plugins/default-blog-options/](http://wordpress.org/extend/plugins/default-blog-options/),
   that may have the part you’re looking for, but the basic rule here is this: Use
   a plugin to make WP do what you want, don’t edit core.
 * You wanna edit, you’re on your own.
 *  Thread Starter [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662262)
 * Im not planning on updating WP in the future, so I should be ok with editting
   the core, but I understand why you are against it.
 * Ill give that plugin a try, hoping that multisite hasnt changed to much since
   3.0.1
 * Thanks for the help! If it doesnt work, Ill try adding this:
 *     ```
       <?php
        update_post_meta($id, "_wp_page_template", "new_template.php");
       ?>
       ```
   
 *  Thread Starter [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662268)
 * plugin doesnt work 🙁 doesnt show my pages/posts/tags/etc
    Code also doesnt work(
   unless I do it wrong lol)
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662272)
 * > Im not planning on updating WP in the future, so I should be ok with editting
   > the core, but I understand why you are against it.
 * Now that’s just stupid. Sorry, but you should ALWAYS upgrade WordPress when a
   new version comes out.
 * The older plugin’s not supported anymore (which is why I generally don’t suggest
   it), but since you seem to understand how the basis of the code works, you should
   be able to spend some time rewriting it and making it work for what you need.
   Basically this: Spend your time learning to write a plugin vs editing core.
 *  Thread Starter [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662423)
 * ok, still having the same problem.
    sort-of fixed the plugin, but it doesnt do
   what I need it to do.
 * Here again what I try to get:
 * Every new registrated site should automatically get a default static page WITH
   a template (normally you can add a template on the right side while creating 
   or editting a page). This template is already created and working.
 * The reason I want this, is that the page is needed, but also because I want to
   disable the option forsite-admins to create any other pages.
 * If there is any other way than messing with the core, Ill take it.. but if not,
   Ill take it aswell.
 * All help is welcome! Thanks in advance!
 * PS. normal page template is “page.php”.. how about replacing that with my own
   code? Or will that mess up a contact form page for example?
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662430)
 * >  I want to disable the option forsite-admins to create any other pages.
 * ANY pages? Hide the menu.
 * [http://wordpress.org/extend/plugins/admin-menu-editor/](http://wordpress.org/extend/plugins/admin-menu-editor/)
 * > PS. normal page template is “page.php”.. how about replacing that with my own
   > code? Or will that mess up a contact form page for example?
 * That’s something you’d do in a theme, really. Change the theme template and off
   you go.
 *  Thread Starter [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662444)
 * Thanks Ipstenu!
 * Both worked.. now the last thing I need is to automatically create a page.
    I
   was hoping this could be done in functions.php – Something like this:
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   The maximum number of lines of code that you can post in these forums is **ten
   lines**. Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * However, it doesnt work because of a “hook” but I dont know which one or how 
   to edit this code.
    Also I would like to hide or delete the creation of a blogpost(
   which is visible everytime a new site is made)
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662451)
 * The more you tell us about what you’re limiting people on their site, the more
   I wonder what the heck you’re doing (and yes, it usually does matter).
 * If people can’t make new posts or pages on a site, what CAN they do, and why 
   are you mucking around with giving them these sites?
 *  Thread Starter [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662453)
 * My intention is to let people create their own 1 page site.
    (yoursite1.domainname.
   com for example)
 * On this 1 page they get are widget area’s (now by selecting a template).
    But
   since they can add whatever to a page, I want to restrict access to the page-
   menu by hiding it. However, if I hide that menu, people cant create that 1 page
   right? And that “Example Page” they do get has a title + text in it AND it doesnt
   have the template selected (so the widget areas are not there).
 * If it was the way I want it to be it would be like this:
    – Person makes a site.–
   Site automatically gives person a Page (not visible in the main-menu, since that
   is a sidewide menu). – Person fills in the widget area’s with widgets (since 
   the Page has a template)
 * The person does not see an example-blog-post and a example-page, just the 1 (
   custom) page I created with widget area’s.
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662454)
 * I think Multisite’s the wrong way to do this. What you’re doing is taking a car
   and making people use it like a unicycle instead. It CAN be done, but you’re 
   putting in a metric tonne of effort for it.
 * I would use Custom Post Types and a Memebers plugin instead.
 *  Thread Starter [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * (@ferdri3)
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662455)
 * in that case there wont be sub-domains which is demanded.
 * Im sure there is a way in functions.php for example to make a page by default.
   How else do the 2 example pages get created.
 * The template isnt an issue anymore because I changed page.php so any new page
   should have the layout with widgets in them.
 * I searched a little more and found this for functions.php:
 *     ```
       add_action('wpmu_new_blog', 'default_settings', 100, 2);
       function default_settings($blog_id, $user_id){
           switch_to_blog($blog_id);
   
           // setup your page here
   
           restore_current_blog();
       }
       ```
   
 * and page setup should be something like this:
 *     ```
       $pages_to_create = array_diff($default_pages,$temp);
       foreach($pages_to_create as $new_page_title){ 
   
       // Create post object
       $my_post = array();
       $my_post['post_title'] = $new_page_title;
       $my_post['post_content'] = 'This is my '.$new_page_title.' page.';
       $my_post['post_status'] = 'publish'; $my_post['post_type'] = 'page';
       ```
   
 * However, this goes a bit beyond my php knowledge and I have no clue how to get
   this work, IF it even works
 *  Moderator [Ipstenu (Mika Epstein)](https://wordpress.org/support/users/ipstenu/)
 * (@ipstenu)
 * 🏳️‍🌈 Advisor and Activist
 * [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/#post-2662459)
 * I don’t often say this.
 * WordPress is possibly the wrong tool for this job.
 * Based on the requirements you provided (One page on a subdomain that can’t be
   edited, added to, etc, save the ‘widgets’), there’s no _good_, easy, sustainable
   way to do this. I mean… You’re just going to be miserable, and I’d say screw 
   it and do this one manually. Make a manual subdomain, put one damned html file
   in, call it a day.
 * The users can fill in a form to say ‘I want this…’ and it’s a static page.
 * If you use Multisite, you’re totally crippling it and forcing yourself to rely
   on multiple tweaks and hacks. If you use anything else, you have a harder time
   with the subdomains. I mean, the only other subdomain method I know of off the
   top of my head is [http://wordpress.org/extend/plugins/wordpress-subdomains/](http://wordpress.org/extend/plugins/wordpress-subdomains/)

Viewing 15 replies - 1 through 15 (of 18 total)

1 [2](https://wordpress.org/support/topic/static-frontpages/page/2/?output_format=md)
[→](https://wordpress.org/support/topic/static-frontpages/page/2/?output_format=md)

The topic ‘Static frontpages’ is closed to new replies.

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 18 replies
 * 2 participants
 * Last reply from: [ferdri3](https://wordpress.org/support/users/ferdri3/)
 * Last activity: [14 years, 2 months ago](https://wordpress.org/support/topic/static-frontpages/page/2/#post-2662469)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
