I am trying to customize parts of the header.php in Wordpress Genesis framework through a code in functions.php like this:

```
if ( class_exists( 'page-template' ) ) {
    remove_action( 'genesis_header', 'genesis_do_header' );
    add_action( 'genesis_header', 'gd_genesis_do_header' );

    function gd_genesis_do_header() {
        echo 'test';
    }
}

```

The goal is to have the modification show up on pages with a certain body class 'page-template'.

The function works without the 'if'-statement' but not with it. What could be wrong here?

Or maybe it is possible to do the action based on a page?