Child theme of FSE theme cannot access is_page
-
Hello
I’ve created a child theme of the Paloma FSE theme which works as expected.
However. When I use the following code within the
functions.php
file and the following code in my/patterns/footer-default.php
file, thevar_dump
of the return value of the function always returnsFalse
.Because I added the
add_action
in thefunctions.php
it also runs without invoking the function in the footer (at the top of the page). This invocation correctly functions on the page and returns the expectedtrue
return value. But when I manually invoke theisPageFrontOrContact()
function, it seems to not be able to figure out on which page it is. Because when I do avar_dump
of the global$post
I receiveNULL
as response.
Why is this not working when manually invoking the function from the footer.php file?functions.php:
add_action('template_redirect', 'isPageFrontOrContact'); function isPageFrontOrContact() { if(is_page(55) || is_front_page()){ return true; } return false; }
/patterns/footer-default.php
<?php var_dump(isPageFrontOrContact()); ?>
- The topic ‘Child theme of FSE theme cannot access is_page’ is closed to new replies.