Literate Programming and WordPress

WordPress is all about user customization. It provides the groundwork for managing your content, and the rest of the creativity is up to you. Not only is WordPress expressive with regard to style but also in how you choose to develop and manage your customization. In this article, you’ll learn about how to apply literate programming concepts to WordPress.

The steps taken in this article are compatible with optimized WordPress Hosting accounts.

What is Literate Programming?

Literate programming is an alternative way to write computer programs.

Traditional programs consist of a file, or series of files, that contain the source code of the program interspersed with optional comments about what the discrete bits of code are doing.

Literate programming flips the traditional scheme. A literate program is a written document interspersed with bits of code.

However, since literate programming is not the standard mode of programming, there are few applications out there that support it. One of the most common and widely available applications to provide support for literate programming is the emacs text editor.

In order to follow along with this tutorial you will only need to install emacs and set up a desktop server for WordPress.

Literate Programming and WordPress

WordPress provides an ideal use case for literate programming via its theme and plugin architecture.

You can completely customize your WordPress site without ever touching the massive source code. With custom themes and plugins, you can write small, discrete programs that “hook” and “filter” the behaviors and functions provided by the core.

Literate programming provides a uniquely cohesive way for you to manage the code for your themes and plugins by placing all of your code in a single file.

How To Install The Freerun Base Theme

Follow these steps to install and “tangle” the sample theme. (The file itself contains instructions as well.)

  1. Download the theme from GitHub
  2. Create a new directory in the /wp-content/themes/ directory for your theme files
  3. Place the README.ORG file in the new theme directory
  4. Open the README file in Emacs
  5. Enter the key command Ctrl-C Ctrl-V t

Emacs will “tangle” the necessary files (create them in the directory) so that your theme will be available in WordPress.


That is one example of how you can introduce literate programming fundamentals into your WordPress development workflow. If you have any comments or questions feel free to drop them below.

CM
Christopher Maiorana Content Writer II

Christopher Maiorana joined the InMotion community team in 2015 and regularly dispenses tips and tricks in the Support Center, Community Q&A, and the InMotion Hosting Blog.

More Articles by Christopher

Was this article helpful? Join the conversation!