Separate home controller for subsite in silverstripe 3 - silverstripe

I have successfully installed subsite module in silverstripe, I just wanted to know that, is it possible to create 2 separate HomePage controller for main site and subsite.
I am trying to remove gallery field and tab from subsite home page not from main site home page.

Are both homepages the same controller by default or two totally different controllers? You can check in your getCMSFields() for the current subsite ID
if ($this->SubsiteID !== 1) {
//remove fields
$fields->remove('NameOfTab'); //e.g. 'Gallery' for tab Root.Gallery
//do other stuff
}
In frontend or when you're not in a Dataobject or Page which is directly related to a subsite you can check for the subsite calling Subsite::currentSubsiteID(), see code on github

Related

How do I add /lang to the Wordpress homepage url?

How do I add a /lang to the home url of a Wordpress site? I've got a project with a special Wordpress multisite setup instead of a language plugin setup. I need to be able to set the homepage to www.homepage.com/lang-1 without always having the /lang-1 in every url.
I've tried doing this via permalinks but Wordpress redirects to the link without /lang-1. Is there a way to fix this? I know how to change the home page but I want to change the link to the home page.
To set the home page with custom page
Click on Settings >> Reading in your admin dashboard.
Set Your homepage displays to A static page (2nd option)
Select the static page we created (lang-1) as the Homepage
4 .Click Save.

How to go from a worpress blog to a worpress website

I've initialize a wordpress blog, but it was an error because i'm looking for a wordpress website initialization.
How can i go from a worpress blog initializing to a wordpress website ?
They are one and the same, the only difference is setting a static home page.
After creating your home page you go to "Setting > Reading" and change the option "Your homepage displays" to static, in the dropdown under "Homepage" select the page you want to use.

Custom wordpress theme template page is not public

I am new to wordpress. I have made a custom wordpress theme and have added a few page templates to it, that I have used on different pages. Now the issue is that When I deploy the website on the server the the pages are not public (i.e. the user is asked to enter the username and password before he/she can visit the page). Although I have made them public in the edit page section, but they are still not public. When I change the theme and use any of the default WP themes the pages are public. Need some help in this regard.
Thanks.
If it works with the default theme and not yours, its definitely a theme issue, do you have a link to your site or a link to the theme you are using?

Automatically add more pages on wordpress multisite install

I want to make 5 pages with a navigation on wordpress multisite.
That means when a new user registers for a new site, he/she will get a new site with 5 default pages with a navigation menu. Can anyone help?
I found it at last. :)
It is in
wp-admin/includes/upgrade.php
function name
wp_install_defaults();
overwrite this function to generate custom posts and pages on wp install.

Give permission to administrator to view the plugin page

I am developing my own plugin.
Under my plugin's directory I have a file called migrate.php. I would like to be able to navigate to this page, without having it be in the left menu.
When I go to
admin.php?page=myplugin/migrate.php
// ERROR: You do not have sufficient permissions to access this page.
How can I grant permission to the administrator to view this page ?
My guess is that the page view is failing because the slug you are using isn't defined as a slug (ie by being added as a menu or submenu).
You could work around this by calling the PHP file directly, but then you'd need to include the WordPress loader to load the WordPress environment.
Hope this gets you a little closer ...

Resources