I am using react-admin previously admin-on-rest. I want to create a custom page that doesn't show the Menu sidebar, like Login page. I will use this page reset user's password. How can I do that?
Go to WordPress Admin Panel > Pages > Add New. You can see the new custom page template listed on the right side. Create a new page and set its template to PageWithoutSidebar. Once done, Publish it.
A custom page lets you use a different layout from your regular pages in WordPress. Many WordPress sites have custom page layouts for their sales pages, landing pages, webinar pages, and more.
This is not obvious in the documentation but the Route
actually accepts a noLayout
prop:
<Admin
customRoutes={[
<Route
path="/custom"
component={CustomRouteNoLayout}
noLayout
/>,
<Route
path="/custom2"
component={CustomRouteWithLayout}
/>,
]}
>
I'd like to add on to Gildas Garcia's answer. After you added the customed routes as shown in the documentation, you need to add a hash #
in front of the route url to be able to view the content.
For example, if you are displaying the view at localhost:3000/
, and one of your routes is
<Route exact path="/foo" component={Foo} />,
then you should go to localhost:3000/#/foo
to view the content.
Add a custom route with the component you want to render. When route is successful the specified component will be presented. No Menu
will be shown just whatever you have in the component you send as prop to Route
.
The way you put the question it seemed like you were trying to have a custom page that hadn't a MenuItemLink
in Menu
. Had to reread the question to understand what you wanted.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With