Skip to content
Meta Boxes and Helpers for post-formats in WordPress
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
Readme.markdown
composer.json
post-formats.css
post-formats.js
post-formats.php

Readme.markdown

post-formats

Provides meta boxes and all required code to get the WordPress post formats working in the admin panel.

Does not provide any helpers for displaying in your theme.

Install

You can install through composer using the command:

composer require arcath/post-formats

Usage

Requiring composer autoload will add the PostFormats class.

functions.php

require_once('vendor/autoload.php');

$formats = array('gallery', 'video');
asort($formats);
$post_formats = new PostFormats($formats, array('post', 'page'));

new PostFormats takes 2 arguments, an arry of formats to enable (which I have sorted alphabetically above) and an array of post types to enable them for.

In your theme

The contents of the meta box is stored in _post_format_{POST_FORMAT} in the post meta.

For example to get the array of gallery IDs you would look at _post_format_gallery.

More info can be found in this post.

You can’t perform that action at this time.