Here’s a bit of code that will allow you to add a footnote to your post – inline. It’s easy enough to add footnotes manually, sure. But where’s the fun in that?
add_shortcode( 'footnote', 'footnote_shortcode' );
function footnote_shortcode( $atts, $content ) {
extract(shortcode_atts( array() , $atts));
global $post;
update_post_meta( $post->ID, '_footnote', $content, get_post_meta( $post->ID, '_footnote', true ) );
return ' <a href="#fn_'.$post->ID.'">*</a> ';
}
add_filter( 'the_content', 'append_footnote' );
function append_footnote($content) {
global $post;
if ( get_post_meta( $post->ID, '_footnote', true ) != '' )
$content .= '<p id="fn_'.$post->ID.'">* '.get_post_meta( $post->ID, '_footnote', true ) .'</p>';
return $content;
}
A footnote could then be added like this:
The moon is 384,403 km [footnote]238,857 miles[/footnote] from the earth.
There might be a better way to append the footnote to the end – so feel free to investigate and improve.