3

How can I remove "Proudly powered by WordPress" from twentyeleven without modifying footer.php, and without creating a child theme?

I'm looking for a php command, such as add_action, remove_action, add_filter, or something of that sort.

I'm not looking for CSS to hide the footer.

I don't want to modify any of the theme files other than functions.php

Is this possible? For reference the code in the footer that is creating this is below.

<div id="site-generator">
    <?php do_action( 'twentyeleven_credits' ); ?>
    <a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyeleven' ) ); ?>"
    title="<?php esc_attr_e( 'Semantic Personal Publishing Platform', 'twentyeleven' ); ?>"
    rel="generator">
    <?php printf( __( 'Proudly powered by %s', 'twentyeleven' ), 'WordPress' ); ?></a>
</div>
4
  • 1
    why do you not wanted to edit the footer? That's where the code is. Mar 31, 2012 at 1:47
  • @cale_b - I'm sure there are in fact several ways to do this without editing the footer.
    – cwd
    Mar 31, 2012 at 3:58
  • @JoeTaxpayer - because when the theme is upgraded it reverts back.
    – cwd
    Mar 31, 2012 at 3:58
  • Got it. Makes sense. I'm starting to use Thesis and haven't seen what breaks/reverts during update, but I understand the point. Thanks. Mar 31, 2012 at 16:27

1 Answer 1

6

There are 3 methods.

  1. Somewhat weird but since this text is internationalized you can filter the output. This is just an example to remove the text, the link is still present in the source.

    add_filter('gettext', 'remove_powered_by', 20, 3);
    
    function remove_powered_by( $translated_text, $untranslated_text, $domain ) {
    
        $custom_field_text = 'Proudly powered by %s';
    
        if ( !is_admin() && $untranslated_text === $custom_field_text ) {
            return '';
        }
    
        return $translated_text;
    }
    
  2. Use jQuery (or javascript)

    $('#site-generator').remove();

  3. Create a child theme and just comment out the code or delete it.

1
  • 2
    +1, but only because of option #3. I think using a Child Theme is definitely the way to go. :) May 30, 2012 at 21:51

Not the answer you're looking for? Browse other questions tagged or ask your own question.