The team is now working on the WordPress Interactivity API. This unblocks the same UX Frontity framework enabled but directly in WordPress Core, fully compatible with the new Site Editor.
Hi,
Let’s say: I have 2 headers (Including Navigation), I want to show “Header 1” on “Home Page”, And I want to show “Header 2” on the other pages. I hope it’s clear for you guys
Also I want to add some “css” to the “Navbar” when the page scrolls, How to achieve this ?
BTY:I am using “React-Bootstrap”.
Thanks A lots
mburridge2
Hi @zaid_sameer
One way to do this would be to conditionally test if you’re on the homepage and return different content from header.js like this:
const Header = ({ state }) => {
const data = state.source.get(state.router.link);
if (data.isHome) {
return (
<>
<Container>
<StyledLink link="/">
<Title>This is the home page</Title>
</StyledLink>
<MobileMenu />
</Container>
<Nav />
</>
);
} else {
return (
<>
<Container>
<StyledLink link="/">
<Title>This is an inner page</Title>
</StyledLink>
<MobileMenu />
</Container>
<Nav />
</>
);
}
};