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.

rochuswolff.de
[i:rrhoblog]

delirium

· Dienstag, 8. November 2005 [W] · 14:36 Uhr ·
abt. für wörter dieser welt

gerade einen apfel golden delirious gesehen. brauche dringend einen kaffee.

wordpress hack: footnotes for paginated posts

· Dienstag, 8. November 2005 [W] · 01:03 Uhr ·
abt. für blogging & metablogging

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[0] = $post->post_content;

and change it to

$pages[0] = $content;

that's it. now upload this version of functions.php into your wp-includes folder.

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:

this is a text.[1] it has a footnote.

Notes

  1. this is a footnote. [back]

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 ...

Logo von Movable Type

druckerfreundliche Ansicht

Zum Seitenanfang

© 2004 Rochus Wolff

Diese Seite wurde zuletzt am 14.11.2005 verändert.
Adresse dieser Seite: http://www.rochuswolff.de/weblog/archiv/2005/11/08/index.shtml