I have been using the same piece of code to remove the Genesis footer from various sites for some time.
However I recently noticed that this was not working on the Metro Pro theme. The existing footer was still present and it seemed to insert my new one instead, I ended up with two!
So if you are trying to update your Genesis copyright message through code and you’re having problems then hopefully the following post might help.
remove_action( 'genesis_footer', 'genesis_do_footer' ); add_action( 'genesis_footer', array($this,'custom_footer') );
It turns out that this effect is caused by the move to an HTML5 powered Genesis 2.0 theme, and the solution is simple enough:
//REMOVE remove_action( 'genesis_footer', 'genesis_footer_markup_open', 11 ); remove_action( 'genesis_footer', 'genesis_do_footer' ,12); remove_action( 'genesis_footer', 'genesis_footer_markup_close', 13 ); //REPLACE add_action( 'genesis_after', 'genesis_footer_markup_open', 11 ); add_action( 'genesis_after', array($this,'custom_footer'), 12 ); add_action( 'genesis_after', 'genesis_footer_markup_close', 13 );
What’s going on here?
The HTML5 structure allows Genesis to construct different containers on your page, we therefore need to remove each part of this, and then rebuild it. The key here is to get the priorities in correctly so that everything is constructed in the right way.
The official documentation is here, but, at the time of writing at least, it isn’t clear how to do this.
Metro Pro Copyright Footer Message
It transpires that some genesis child themes have a little custom footer code in them already and the Metro Pro is one of them. If you look in the functions.php file of the Metro Pro theme you will see this removal and addition of these actions is in there already. Note that the new actions are added back in with different priorities.
I actually had some issues getting the old footer to be completely removed, I was seeing two copies of the copyright message appearing at the bottom of the page. For some reason the remove action code wasn’t working correctly. My understanding is that I should be able to remove the child theme’s actions as long as I match the priorities but it didn’t seem to work.
In the end the easiest solution was to comment out the add_action in the function.php file so that only my plugin code was effective.