WP SITES

3083 Coded Tutorials & 286 Plugins

2 Ways To Modify The Genesis Footer Credits Conditionally

Using a code editor & FTP or File Manager in cPanel, add 1 of the following PHP code snippets to the end of your child themes functions file.

You can then modify the text & HTML links in the code to your own requirements.

All code snippets generate 2 different footer credits.

The 1st set of credits in each code snippet displays on the front page and the 2nd displays on all other pages.

1 : Uses the genesis_footer_output filter conditionally

add_filter( 'genesis_footer_output', 'filter_custom_footer' );
function filter_custom_footer( $output ) {
if ( is_front_page() ) :
    $output = sprintf( '

%s<span class="dashicons dashicons-heart"></span>%s<a href="https://www.studiopress.com/">%s</a>

',  __( 'Handcrafted with ' ), __( ' on the' ), __( ' Genesis Framework' ) );
    return $output;
    else :
    $output = '[footer_copyright] &middot; <a href="https://mydomain.com">My Custom Link</a> &middot; Built on the <a href="https://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a>';
    return $output;
    endif;
}

3 : Removes the footer & adds it back with custom footer credits conditionally

remove_action( 'genesis_footer', 'genesis_do_footer' );
add_action( 'genesis_footer', 'conditional_footer_text' );
function conditional_footer_text() {
if ( is_front_page() ) :
    printf( '

%s<span class="dashicons dashicons-heart"></span>%s<a href="https://www.studiopress.com/">%s</a>

',  __( 'Handcrafted with ' ), __( ' on the' ), __( ' Genesis Framework' ) );
    else:
    echo '

&copy; Copyright 2012 <a href="https://example.com/">My Domain</a> &middot; All Rights Reserved &middot; Powered by <a href="https://wordpress.org/">WordPress</a> &middot; <a href="https://mydomain.com/wp-admin">Admin</a>

';
    endif;
}

Modified from StudioPress Code Snippets.

Learn more about using conditional tags.

Related Tutorials

One response to “2 Ways To Modify The Genesis Footer Credits Conditionally”

  1. Yogesh Khetani Avatar
    Yogesh Khetani

    Thanks for the help.

Leave a Reply

New Plugins