Skip to content

Customizing b4st for Post Formats

Simon Padbury edited this page Dec 21, 2017 · 2 revisions

b4st can handle WordPress Post Formats, because in functions/setup.php it has:

// Add post formats support. See http://codex.wordpress.org/Post_Formats
add_theme_support('post-formats', array('aside', 'gallery', 'link', 'image', 'quote', 'status', 'video', 'audio', 'chat'));

There are three ways that you can customize the design of post formats in b4st:

(1.) Customized Styling (CSS)

Even if you do nothing else, you can style the post formats differently CSS classes:

  1. On index.php, category.php and author.php, the looped posts (or exerpts) each have an <article> wrapper tag that has a CSS class according to the post format (e.g. .format-aside, .format-quote).

  2. On single.php, the <body> tag has a class specific to your single posts's post format (e.g. .single-format-aside, .single-format-quote).

(2.) Customized Index-Posts

The index.php template (and author.php and category.php) obtains its loop from the partial loops/index-loop.php. And each individual [post or excerpt] within that loop uses another partial, called loops/index-post.php.

To make your own specific design for, e.g. aside [posts or excerpts] where these are displayed on index.php, you can make a duplicate of loops/index-post.php and rename it as loops/index-post-aside.php. Then you can modify your new partial to suit your requirements.

(3.) Customized Single-Posts

The single.php template obtains its content from loops/single-post.php.

To make your own specific design for, e.g. aside single posts, you can make a duplicate of loops/single-post.php and rename it as loops/single-post-aside.php. Then you can modify your new partial to suit your requirements.

Note: the partial loops/single-post.php has in it only the "main column content" of your single-post. You will still get the same header, sidebar and footer called by single.php. But if you wish your various post formats to be more radically different from each other, then you must start by redesigning single.php. For example:

  1. Cut the sidebar-call from single.php and paste it into loops/single-post.php.
  2. Make a duplicate of loops/single-post.php and rename the new file as loops/single-post-gallery.php.
  3. Redesign loops/single-post-gallery.php. (You can even remove the sidebar if you need the full width for the gallery.)