WordPress.org

Ready to get started?Download WordPress

Forums

creating footnotes in posts (16 posts)

  1. richards1052
    Member
    Posted 9 years ago #

    I've seen footnotes in posts before (in which you'd see a number in the body of the post linked to the footnote displaying at the end of it). Can someone tell me what the code looks like?

  2. Kafkaesqui

    Posted 9 years ago #

    Perhaps Alex King's Quicktags solution will work for you:

    http://www.alexking.org/blog/2004/11/28/footnotes/

  3. richards1052
    Member
    Posted 9 years ago #

    It's an almost solution because I see that his plugin will not provide a link from the footnote itself back to the post text. So you have to manually navigate your way back to the post when you're done reading the footnote. You need that link to take you back automatically to the precise spot in the post you left. Otherwise, the post reading experience is interrupted.

  4. Kafkaesqui

    Posted 9 years ago #

    There's few problems (of this sort, anyway) that can't be resolved:

    http://guff.szub.net/downloads/quicktags-footnote.zip

    With this footnotes are referenced "fn-1119862043343" and their originating points in the post are referenced "1119862043343". I used a spade (♠) for the linkback character, but that can be changed; just go to near the end of quicktags.js, look for this line:

    var footnote = ' <li id="fn-' + fnId + '">' + note + ' <a href="#' + fnId + '" title="return">&#9824;</a></li>' + "\n"

    and change the character reference (&#9824;) to whatever you want to use.

    I've incorporated this into quicktags.js from WordPress 1.5.1.2, so it's all up to date as well.

  5. richards1052
    Member
    Posted 9 years ago #

    Thanks for that solution. Do I place the file into my root directory or into plugins?

    And when you actually want to create a footnote how do you do it? Or am I going to use this to piggyback on Alex's plugin (which would provide you the footnote interface).

  6. Kafkaesqui

    Posted 9 years ago #

    The file I made available is a replacement to the quicktags.js in wp-admin/. Just delete the one there currently and drop this in. It will provide the same *interface* for Quicktags, adding the footnote button.

    It's a duplicate of Alex's work, only it incorporates the linkback component.

  7. richards1052
    Member
    Posted 9 years ago #

    Wonderful & thanks for fully explaining it to me.

    I installed it & see the Footnote quicktag in the Write post box. But I tried typing some text & clicking the Footnote button. The button became smaller but nothing happened inside the text box. What's supposed to happen or am I using it wrong?

  8. moshu
    Member
    Posted 9 years ago #

    Put a number, like "1" in the post and highlight it, then click the footnote button. There should be a popup field to write your note. It works like a charm :)

  9. richards1052
    Member
    Posted 9 years ago #

    OOHHHH! Now I get it. Thanks.

    I think Kafkaesqui should promote this here, at his own site, etc. I hope you wouldn't mind, Kafkaesqui if I write a post on this sometime.

    As my son's Thomas the Tank Engine series say about the very best engines: "they're really useful engines!" That's what this little hack/plugin is too.

    BTW, will this system work for posts that've already been written & published (say, if you wanted to add a footnote after you'd completed a post)? Or will it only work as you're writing the draft post?

  10. moshu
    Member
    Posted 9 years ago #

    Why don't you try it? :) Isn't that faster than typing a question and waiting for an answer?
    (Actually, yes, it works with old posts, too. It doesn't work on paginated posts: I mean the footnotes are created but because of the pagination the links are not working!)

  11. Kafkaesqui

    Posted 9 years ago #

    So richard1052's question to me is, would I have a problem with someone writing about something I've done? Yeah, right! Feel free to write it up. Make sure Alex King gets the primary nod, since I just added to his code.

    I'll look at the issue of having to highlight a number first to generate the footnote. You should also be able to just stop mid-compose, click the footnote button, enter your footnote text and click OK. Probably a browser dependency in the javascript.

    And as moshu notes, there should be no problem editing footnotes into older posts. The post pagination issue he brings up, though...there's always something.

  12. moshu
    Member
    Posted 9 years ago #

    Well, before I forget again: thanks for this great plugin!
    As for the pagination... I figured out with a little bit of manual drag and drop it can be managed.
    However (because "there's always something") if I try to validate the page this is what I get:
    Line 70, column 237: value of attribute "id" invalid: "1" cannot start a name

    ...-1120004096030" class="footnote" id="1120004096030" title="footnote #1">1</a>

    It is possible that you violated the naming convention for this attribute. For example, id and name attributes must begin with a letter, not a digit.

  13. Kafkaesqui

    Posted 9 years ago #

    Now how'd I let that slip by?! Just lost a few net points for that. Thankfully I can blame Alex...

    I'll add a prefix to the generated id (as I did for the footnote). Thanks moshu.

    (Oh, and technically? Not a plugin. ;)

  14. Kafkaesqui

    Posted 9 years ago #

    Ok, version available for download (link above) resolves the invalid XHTML in the reference id. I also slipped in an access key for it (F, of course). On the Windows platform just type Alt-F when composing to add a footnote.

    Wasn't able to verify the problem richards1052 brought up with needing to highlight something first. Running through Firefox and IE6 seem to perform as expected. Opera 7.54 goes quite loopy with it, though. So currently not a cross-browser solution.

  15. drzax
    Member
    Posted 9 years ago #

    Just thought I'd add my solution to the thread.

    New WordPress Plugin: Footnotes

    S.

  16. nieuws
    Member
    Posted 8 years ago #

    You can also just create a footnote within the excerp

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags