WordPress.org

Ready to get started?Download WordPress

Plugin Directory

!This plugin hasn't been updated in over 2 years. It may no longer be maintained or supported and may have compatibility issues when used with more recent versions of WordPress.

Things

An object-oriented approach to WordPress queries and custom post types

An object-oriented approach to WordPress queries and custom post types. Un(der)documented beta.

So, here's the idea: anywhere where you need a loop, use get_things(), which will return an array-like collection of Things. get_things() will return Things from the main query; get_things($query_args) will run a new query for you. Each Thing in the collection is a magical object that will make your life better.

foreach ( get_things() as $thing ):
    // get an attribute (object or string)
    $author = $thing->author;
    // echo an attribute with the_* methods
    $thing->the_title();
    // get another Thing
    $parent = $thing->parent;
endforeach;

Each Thing automatically has properties and associated the_* methods for the standard WordPress data and taxonomies associated with that post type. Meta (custom field) properties are created when you specify meta in your custom post type arguments. If you want to add custom methods or properties, create a subclass of Thing and register that with a particular post type.

Requires: 3.3 or higher
Compatible up to: 3.4.2
Last Updated: 2012-2-26
Downloads: 229

Ratings

0 stars
0 out of 5 stars

Support

Got something to say? Need help?

Compatibility

+
=
Not enough data

0 people say it works.
0 people say it's broken.