I’ve been reading the wordpress codex and it seems that if I want to add some text just before the footer shows up I should use code like this in my functions.php
add_action('wp_footer', 'your_function');
function your_function() {
$content = '<p>This is inserted at the bottom</p>';
echo $content;
}
It is my understanding that the $content should show up just before the footer, but it does not show up at all. Is there another way to show up my code just before the footer ?
I am with WP 2.8 but this should not matter
If you want to add something right before the footer (not in the middle of it), use
That hook runs when the theme file calls the
get_footer()
function.Your code is valid. Just make sure your theme actually fires the “wp_footer” action: somewhere in footer.php probably there must be either do_action(‘wp_footer’) or wp_footer()
The code you provided should work.
Are you certain that you added it in the activated theme? And in functions.php in the root of that theme? You should find the theme folders in
<root>/wp-content/
Your alternative is to add the content directly into the “footer.php” of your theme. Depending on the type of content this may be the better and simpler option.