1

I know there are several questions about the footer, but I did not find answer to this. If this has been asked before, my apologies.

I am developing a widget plugin and I wanted to give users the choice, to display the copyright link in footer instead of the widget.

I know how to display something below the footer by just adding

add_action('wp_footer', 'my_function');

But this would add the information below the themes footer (at least in twentyfourteen and the others)

This is the code from twentyfourteen

    <footer id="colophon" class="site-footer" role="contentinfo">

        <?php get_sidebar( 'footer' ); ?>

        <div class="site-info">
            <?php do_action( 'twentyfourteen_credits' ); ?>
            <a href="<?php echo esc_url( __( 'http://wordpress.org/', 'twentyfourteen' ) ); ?>"><?php printf( __( 'Proudly powered by %s', 'twentyfourteen' ), 'WordPress' ); ?></a>
        </div><!-- .site-info -->
    </footer><!-- #colophon -->

Is there any hook or possibilty add content inside the div class="site-info"? And make this globally possible, so that it works with other templates too that use this hook, if it exists?

2 Answers 2

0

AFAIK there is no fail safe way to implement this into all available themes through a plugin, and IMHO, I really think this is more theme territory than plugin territory, but as I said, that is only my opinion.

The big problem here is that no plugin (not even you) will ever know what markup or hooks, filters or functions is used by a specific theme, let alone know if that specific theme even has wp_footer included.

Your best available hook is the wp_footer hook to add your custom copyright text.

I would probably not worry to much about this, because, let's face it, who is going to install a plugin to show copyright info if the theme they are using already has that feature included, and if they need to extend this, it is probably better to make use of the filter provided by the theme author. So most probably, someone that might download your plugin is someone that might not have this feature included in their theme

A preferable counter option will be to ask the end user to add a specific hook that you've created to their theme where they need to show this copyright text, basically the same idea that a plugin like wp_pagenavi uses to add pagination to a theme. This way, the end user has more control over placement. TBH, I think this is the way forward for something like this.

5
  • Thanks. No the plugin does not only show the copyright. I meant the copyright of the plugin itself. Ok I think I have to just forget the idea and put the copyright to the widget itself
    – Owl
    Oct 3, 2014 at 13:01
  • I would suggest to use the widget. I don't think users will be happy to have other copyright info messing around with their own Oct 3, 2014 at 13:05
  • But it is like I said, best is to ask the user to add a hook to show your copyright info if they need this in the footer. I must admit, I misunderstood your question a bit, but the same would still apply Oct 3, 2014 at 13:08
  • Yes, thx! The plugin will be free and I they do not have to add the link to the frontend, just if they want to support me. So requiring them to add code will most likely end in no backlinks for me :)
    – Owl
    Oct 3, 2014 at 13:11
  • You win some, you loose some :-). Concider accepting my answer if it help. This will ensure that your question stay useful to others. Enjoy :-) Oct 3, 2014 at 13:18
0

Themes from twentyten to twentyfourteen have a hook called twenty{year}_credits inside <div class="site-info">. You can add an action for each of this one to add the copyright.

1
  • Thanks! That would be great, but if other themes does not provide this, it is unfortunatedly only a partial solution
    – Owl
    Oct 3, 2014 at 13:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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