How can I modify footer when footer.php calls to another file?
I am trying to modify the footer of aTheme's Talon theme. I am using a child theme that works properly. How can I modify the footer when footer.php calls for a function that is in function-footer.php?
In footer.php, I have this, which I can modify in the child theme.
footer id="colophon" class="site-footer" role="contentinfo"
div class="container"
div class="row"
?php do_action('talon_footer'); ?
/div
/div
/footer
If I modify ?php do_action('talon_footer'); ?
, the whole footer is gone.
The talon_footer
action is found in themes/talon/inc/functions/functions-footer.php. This file contains 3 actions for the footer: sidebar, credits and menu:
/**
* Footer sidebar
*/
function talon_footer_sidebar() {
if ( is_active_sidebar( 'footer-1' ) ) {
get_sidebar('footer');
}
}
add_action('talon_footer', 'talon_footer_sidebar', 7);
/**
* Footer credits
*/
function talon_footer_credits() {
?
div class="site-info col-md-6"
a href="?php echo esc_url( __( 'https://wordpress.org/', 'talon' ) ); ?" rel="nofollow"?php printf( esc_html__( 'Powered by %s', 'talon' ), 'WordPress' ); ?/a
span class="sep" | /span
?php printf( esc_html__( 'Theme: %2$s by %1$s.', 'talon' ), 'aThemes', 'a href="//athemes.com/theme/talon" rel="designer"Talon/a' ); ?
/div!-- .site-info --
?php
}
add_action('talon_footer', 'talon_footer_credits', 8);
/**
* Footer menu
*/
function talon_footer_menu() {
?
nav id="footer-navigation" class="footer-navigation col-md- 6" role="navigation"
?php wp_nav_menu( array( 'theme_location' = 'footer', 'menu_id' = 'footer-menu', 'depth' = 1 ) ); ?
/nav
?php
}
add_action('talon_footer', 'talon_footer_menu', 9);
The themes/talon/inc/functions/ folder also contains loader.php which calls for the functions-footer.php file:
require get_template_directory() . '/inc/functions/functions-footer.php';
I want to modify it in the child theme.
I have tried to:
- add functions-footer.php to the child theme with the proper path
- add loader.php to the child theme with the proper path and modify the path in the file
it still uses the one in the parent theme.
I have also tried to add require get_template_directory() . '/inc/functions/functions-footer.php';
to the child theme's funtion.php, it tells me the function cannot be declared twice.
If I add one of the functions from functions-footer.php to the child theme's function.php, it breaks the code and returns a white page.
I have worked around it by duplicating the functions I want to modify in the child theme's function.php with a different name and a different class and using css display:none on the original one, but it's not ideal. A php method would be much cleaner.
Thanks in advance!
Topic function-exists functions php Wordpress
Category Web