Skip to content


Integrating org-mode HTML export with a WordPress theme

Org-mode exporting capabilities are excellent, but making a freshly-exported HTML project look good with your WordPress theme might seem non-trivial. As a scientist / analyst / statistician you are way overqualified to be dealing with the minutiae of PHP and CSS, and so you might have resigned yourself to less-than-stellar formatting.

Luckily, the recipe for converting an org-exported HTML file into somethign that looks like an integral part of your blog turns out to take 4 easy steps. Let's assume that I'm in the www/org/project/ directory, and the WordPress blog is in www/blog/ directory.

  1. Make a new file, e.g. project.php, and start it with

    <?php
    define('WP_USE_THEMES', false);
    require('../../blog/wp-blog-header.php');
    get_header();
    ?>
  2. Paste in the contents of the <style> and <script> tags from the org-exported HTML header
  3. Paste in the contents of the org-exported <body>
  4. Paste <?php get_footer(); ?> at the end of the file.

You are done! You are free to mess with minor details (centering of the title, location of the org-exported postamble – sometimes it makes sense to move it into the contents div), but you've achieved the main goal: your spectacular analysis looks awesome. Here's an example of the above procedure in action!

Tagged with , .

Some HTML is OK

(required)

(required, but never shared)

or, reply to this post via trackback.