[an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive] [an error occurred while processing this directive]
Hinweis: Das Design dieser Site ist nur in neueren grafischen Browsern sichtbar, die wichtige Web-Standards unterstützen. Der Inhalt bleibt für alle Browser erkennbar. Nähere Informationen dazu erhalten Sie bald hier; bis dahin finden Sie alles wichtige sehr schön gesagt auf der Homepage von Oliver Klee.
tadaa! please welcome my very first wordpress plugin. err, no. make that a wordpress hack with plugin. and most of the plugin isn't even mine, since the code is a (if heavily) modified version of simon elvery's fantastic footnotes plugin.
what does it do?
this hack'n'plugin will allow you to use footnotes with automated numbering for paginated posts (i.e. posts divided into pages using
<!--nextpage-->). footnotes start at 1 and are incremented throughout the whole post; counting does not start at 1 on every single page.
how do i install it?
first of all (that's the hack part), you will have to do some (minor) modifications of a wordpress core file. you should not do this unless you know what you're doing, and if you do, you do so at your own risk. you have been warned. ;-)
you will have to change two lines in
wp-includes/functions.php. search for the function
setup_postdata (in wp 1.5.2, it starts at line 839) and then, within this function, for the line (should be line 855)
$content = $post->post_content;
change this line to
$content = $post->post_content; $content = apply_filters('format_complete_content', $content);
now, eleven lines below that, find:
$pages = $post->post_content;
and change it to
$pages = $content;
that's it. now upload this version of
functions.php into your
now, the plugin. simply download the plugin here (version 0.1 alpha) un-zip the archive and put
endnotes.php into your plugins folder (usually
wp-content/plugins. activate the plugin through your plugin admin-panel and you're done.
how do i use it?
the plugin should be compatible with simon's - you just put
<footnote>-tags around the endnotes. like so:
this is a text.<footnote>this is a footnote.</footnote> it has a footnote.
this will result in something like:
easy, isn't it?
there are a couple of options that you can change from the plugin's options panel (in options > endnotes):
- you can choose text that will be shown before and after the footnote number (it will appear as part of the link and in superscript if you check "make links superscript"), so that you can easily make those cool footnote numbers in brackets(1), for example. default is "[" and "]".
- you can choose a text that will appear just before the endnotes start on every page. this will appear within
<h4 id="endnotes_head">, so style at will. default is "Notes". (if there is no text here, the
<h4>-tag will not appear.)
- the other options are inherited from simon's plugin: you can choose a "back"-text that will appear at the end of the note and links back to the text, and you can choose whatever should appear before and after that link.
are there any known problems?
please note that this plugin, although it has been tested, might still have any number of glitches. as i said, use at your own risk, and let me know if you happen to find any problems.
there are two known issues that i am aware of so far:
- the excerpt will end right before the first footnote.
- simon's "ref:"-functionality is not included yet.
how does it work?
now this is more for the technically minded ...
simon's footnotes plugin is cool and easy to use, but it has the problem i mentioned earlier: the footnotes will start at 1 on every single page of a paginated post.
a poster called hapax wrote to simon mentioning this particular problem, to which simon offered a solution explained here. this solution is a way out, but removes the main feature from simon's plugin, its automated numbering of footnotes.
it is, however, not possible just to change the plugin to get this job done, because the wordpress code does not yet offer a hook for filters that allows you to modify the content of a post before it is broken down into pages. the hack mentioned above only introduces such a hook and calls it '
my plugin, other than simon's version, now consists of two seperate functions doing the job. the first hooks into '
format_complete_content' and changes every single '
<footnote>' into '
<footnote num="#">' where '#' is the number of the footnote (incremented after every footnote, of course).
the second function does a job very similar to simon's plugin. it will only filter the content of the page that will appear on screen and builds a list with the content of all the notes included in that content. instead of just starting the list with 1, however, it will number the footnotes according to their place in the complete content.
(and yes, i know most of you could have figured that out for yourselves from the code. ;-) )
any comments, remarks or suggestions are welcome. if you find errors and bugs, mistakes or mishaps, please let me know.
thanks again to simon for permitting me to use his code.
© 2004 Rochus Wolff
Diese Seite wurde zuletzt am 08.11.2005 verändert.
Adresse dieser Seite: http://www.rochuswolff.de/weblog/archiv/2005/11/08/01.03.05/index.shtml