• Hi All,
    I want to get my hands dirty with making some mods to the way WordPress works.
    In particular, I want to implement a footnoting system for posts that will allow me to keep footnotes in a seperate table and append them to each applicable post, with an intra post link from the footnoted text to the respective footnote (ie [1] at the point where I’m referring to the footnote and [1] at the beginning of the footnote itself.
    I implemented something similar in the blog application I developed for myself, but didn’t have the heart to start from scratch on it after a server crash.
    I’ve been trying to find some documentation that describes where WordPress actually assembles each post for display, so I can insert some code to retrieve the applicable footnotes, but haven’t had any luck.
    Before I dive in to hundreds (thousands?) of lines of code myself to see if I can find it, I was wondering if a) anyone could point me at documentation that explains this that I may have missed, or b) point me to the location in the relevant file(s) I should be looking at.
    Many thanks in advance!
    planetthoughtful

Viewing 5 replies - 1 through 5 (of 5 total)
  • There’s no need to dive in to the core files at all.
    Inside your index.php, you’ll find what’s called the wp-loop.
    The start of it looks like this:
    <?php if ($posts) : foreach ($posts as $post) : start_wp(); ?>
    The end of it looks like this:
    <?php endforeach; else: ?>
    The stuff in between is what “builds” the posts.
    That said, you should be able to call a function from in there, depending on where you want the content to be, to display your footnotes.
    You may want to check out the Template Tags section in the Wiki.
    You may want to also check out the Plugins section and the Plugin API section for current plugins and info on building one yourself.
    TG

    I’ve found this list of functions and the files they’re located in to be helpful. Also, depending on your environment, grep and the multi-file search feature of less can be useful. Looking at the core code can help you understand what’s going on and plugins allow you to do lots of things without modifying it. The code isn’t rich with comments, but it’s well written and easy to follow — even if it is complicated.
    A good editor that highlights syntax and parentheses and bracket pairs helps a lot. I use the free Crimson Editor and there are a number of other good ones.
    It sounds to me that you’re going to need to write (or find) a plugin that works on the post as it’s published to process your footnotes using the filter hook feature. As suggested above, go to the Plugins section for inspiration (and example code).
    Don’t forget the support forum and the WP Hackers List.

    Thread Starter planetthoughtful

    (@planetthoughtful)

    Thank both to Techgnome and Dennis Williamson! I’m well on the way to developing this plugin, with help from the references you provided.
    Thanks again!
    Much warmth,
    planetthoughtful

    Definitely take a look at the tools mentioned in this entry in Carthik’s WordLog. The code browser is more fun than fireworks!

    Planetthououghtful: I was planning on developing this very same plugin. If you want any help in coding it I will be glad to help.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Where to begin with hacking WordPress?’ is closed to new replies.