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, the var_dump
of the return value of the function always returns False
.
Because I added the add_action
in the functions.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 expected true
return value. But when I manually invoke the isPageFrontOrContact()
function, it seems to not be able to figure out on which page it is. Because when I do a var_dump
of the global $post
I receive NULL
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());
?>
]]>
footer.php
in the root directory of the theme where I am able to handle functions from function.php
]]>