Need homepage attribute to control the footer sitewide
Permalink
I have a chat module in the footer of my site. I have a Checkbox Page Attribute on the homepage that adds a style of hidden, so I can turn off the chat. However, it only works on the homepage even though my code is in the footer.
Any help out there?
Any help out there?
Are you trying to get it so that the attribute on the homepage adds that class sitewide?
Yes, that is exactly what I am looking for.
Instead of
You want
$c = Page::getCurrentPage();
You want
$page = Page::getByID(1);
$page = Page::getByID(1); $chat = $page->getAttribute('chat');
Your code is looking for the chat attribute on each individual page, you would need to set that attribute on every page you want to display the block in the footer. Instead of getting the page with getCurrentPage use one of the other functions to get the page by name, handle, ID, path, ect.