To help me learn WordPress development, I'd like to go "beyond the blog" and build a personal movie library -- similar to IMDb but on a much smaller scale.

I need help understanding how to approach the project in WordPress and what I need to learn.

Here are the types of things I'd like to do on the site:

  • When you visit an actor's page, the actor's films are retrieved from the database and displayed. You can sort the movies by year, title, rating, etc. You can also click on the movie title to go to that movie's page.

  • When you visit a movie's page, the actors in the movie are retrieved from the database and displayed along with information like a movie summary, my rating, and whether I own the DVD.

  • On the homepage, you can perform a search for movies. For instance, if I'm in the mood for an '80s comedy, I can search for movies in the Comedy genre released between 1980-1989 and that I own on DVD.

I can already write all of the PHP and MySQL that's needed, but I don't understand where the code actually goes in WordPress. For example...

  • Would this application require building a plug-in, or just adding code to my theme?

  • Would each actor's page be treated as a "page" or would it be treated as a post?

  • For the actor pages, where would the query go that retrieves the list of movies?

  • When the search form is submitted, where is the script located that would process the search request?


I'm just looking for a push in the right direction regarding how WordPress would handle an application like this. Thanks in advance!

1 Answer 1


Plugin vs. Theme vs. MU-Plugin vs. Drop-In

»Would this application require building a plug-in, or just adding code to my theme?«

Basically all four are the same. They differ only in two points:

  1. Location and

    • MU-Plugins are in the mu-plugins folder 1)
    • Plugins are in the plugins directory
    • Drop-Ins live in the wp-content folder as single files outside of folders
    • Themes are in the themes directory and/or any other directory you registered via register_theme_directory(); (which should be done in a drop-in).
  2. Loading order and therefore access to wordpress hooks.

    • MU-Plugin - can access 'muplugins_loaded'
    • Plugin & Drop-In - can access 'plugins_loaded'
    • Theme - can access 'after_theme_setup'

… and later hooks.

Custom Post Types

»Would each actor's page be treated as a "page" or would it be treated as a post?«

WordPress comes - out of the box - with some built in post types

  • Post
  • Page
  • Attachment/Media
  • Link
  • Nav Menu Item

But you got the possibility to add your own CPTs 2). Just read the linked Codex article on how to setup your own CPTs of Movie/Actor or use a set of classes as a base, like this great one (incl. a tutorial) by Toscho.

Custom Taxonomies

WordPress also got built in Taxonomies

  • Categories (hierarchical)
  • Tags (non-hierarchical)
  • Link Category (for links post type)
  • Post Format (for post post type)

Templates and Themes

»For the actor pages, where would the query go that retrieves the list of movies?«

WordPress got the Template Hierarchy. Basically it's two things:

  1. A routing mechanism - tells which theme file to load - if it exists
  2. A query altering mechanism - tells which files to load

This post by @Rarst will tell you the basics about how to alter the WP_Query to get exactly those posts that you want, when WP doesn't already deliver it by you request.

Standard installations stripped

Sometime you might want to reduce WP a bit to get a cleaner interface for your APP. Just take a look at WP Strip Naked as a starting point.

If you got additions for the plugin, just leave a comment, or - even better - change it and make a pull request on github.

Post Relationships

Posts2Posts is the way to go if you need to interconnect posts or CPTs. Trying to deal with it without the plugin makes actually no sense, as the author is core contributer and constantly cares about developing it further.

Special Purpose Meta Boxes

When you need special fields for your post types, then you better use a library like for example the RW_Meta_Box class set. As with the Posts2Posts Plugin, it makes no sense to try to get around this yourself - it's not worth the effort 3).

Altering the search

»When the search form is submitted, where is the script located that would process the search request?«

In general, WP has built in stuff (called template tags) to display the searchform, the search results page, etc.

There's already another answer, where I wrote about this in detail. The approach can be adapted to fit your use case.

Hooks & Filters

In many cases you might want to use a hook or filter in your themes functions.php or a plugin file, instead of altering the output. Generally said, it's a way to modify stuff on the flight and on demand. This helps making your APP more performant plus keeps code outside your templates. Pleas just read more about this topic in the Codex.

Alternative approach with plugins

As always for special cases, you got PODS for the rescue. This plugin is the swiss army knife for all sorts of special purpose content types. Plus it got built in relation ships with custom as well as built in stuff (from users to post types).


1) »One thing to note is that the Must Use Plugins don’t work like regular plugins which are typically each stored in their own directory with one file that contains a plugin header. With MU plugins WordPress only looks in the mu-plugins directory for .PHP files and not for files in subdirectories so if you want to move regular plugins over to the MU plugins directory you’ll probably need to create a proxy .PHP file. That file should contains a PHP require_once() to include the plugin’s main .PHP from its subdirectory, or you can create a single .PHP file with a require_once() for each of the plugins you have in the mu-plugins directory.« Mike Schinkel on hakres blog on MU-Plugins topic

2) CPT is short for Custom Post Type

3) I dropped the development of my own set of classes about 2 month ago and invested my time into Rilws/Anhs library. The development is going fast and we reply to nearly every pull request with a "Thank you".

  • Thanks - this is really helpful, especially the info on CPT's and the Posts2Posts plugin. Can you tell me which WP book does the best job explaining how to work with CPT's and, more generally, the type of custom functionality I'm trying to build?
    – cantera25
    Feb 23, 2012 at 7:03
  • 1
    You don't need a book for that. Just start with setting up your custom post types and custom taxonomies. Then add your meta boxes and last but not least, configure the posts2post plugin. That's it. The rest can be read in the codex or here on WPSE. Just find the topics you want to know about, search for the according tag feed here on WPSE and read some of the better and more detailed answers. That will boost your knowledge far enough, as that you can built your APP and have enough know how to ask the right Qs afterwards.
    – kaiser
    Feb 23, 2012 at 7:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.