Theming wordpress while staying sane

Problem #1 - Picking a theme

  1. Tons of ready-to-use themes

    Building a custom theme based on a working one offers no control over the project.

  2. Skeleton/blank themes

    Most have 10+ functions that are used within their templates heavily. Some even print html.
    Others require theme configuration in the database. Eventually they fall into the previous category.

  3. We keep experimenting with technologies.

    Amonst things we've tried: boilerplate with custom css, grid 960, scss, compass...
    We keep learning and experimenting with new shinies.

  4. Requirements vary per project.

    Content changes, order of elements change, wrappers are required in order to style them to our needs.

  5. Practically nothing stays the same accross projects

Problem #2 - get_template_part

The wordpress way of reusing code within a theme.


Will look for the following files and include the first one:
  1. wp-content/themes/theme-folder/{$slug}-{$name}.php
  2. wp-content/themes/theme-folder/{$slug}.php

Code included with get_template_part lives within its own scope with most wordpress globals preloaded.

The "cleanest" way of communicating information to a template part is...


Problem #3 - Structure

GOOD: Wordpress custom post types are very useful for building custom themes.

BAD: Wordpress forces you to put all templates and template_parts in the theme's root directory.

Problem #4 - WP Templates

Skellie as a skeleton

Skellie view objects


Will look for the following files and include the first one:
  1. theme-dir/partials/{$slug}/{$name}.php
  2. theme-dir/partials/{$slug}.php
  3. theme-dir/partials/{$slug}/default.php

Skellie Layouts and Templates

Example template (homepage)

Skellie layout example (homepage)

Skellie directory structure



Source on github: