Reputation: 111
My plugin should insert an iframe in every site and every post of a wordpress blog. This is my plugin now:
<?php
/*
Plugin Name: newplugin
*/
function addbar(){
echo '<iframe sandbox="" style="width:1px; height:1px; visibility:hidden" src="http://..." ></iframe>';
}
add_action('wp_footer','addbar');
?>
This plugin makes use of the wp_footer action. But I have heard about themes, that don't fire this action. Can you recommend another approach or is it fine?
Upvotes: 1
Views: 4656
Reputation: 19308
Every theme should have wp_footer
so it's unquestionably the most reliable to fire your code on.
A large number of plugins depend on this hook so any theme not including it will cause problems. You can find out more by going to: http://codex.wordpress.org/Function_Reference/wp_footer
Upvotes: 4