• Resolved dragongamer54

    (@dragongamer54)


    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, 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());
    ?>
    • This topic was modified 1 year, 7 months ago by dragongamer54. Reason: Some horrible span styling got in the way of the functions code
    • This topic was modified 1 year, 7 months ago by dragongamer54.
Viewing 1 replies (of 1 total)
  • Thread Starter dragongamer54

    (@dragongamer54)

    I ended up creating a different child theme based on twentytwentyone. The main take from this child theme is that I used some files like footer.php in the root directory of the theme where I am able to handle functions from function.php

Viewing 1 replies (of 1 total)
  • The topic ‘Child theme of FSE theme cannot access is_page’ is closed to new replies.