Featured Content: Getting Started
Ahead of our first official office hours, here is an overview of what I would like to discuss:
What is Featured Content?
Obenland discussed the high-level concept here: https://gist.github.com/obenland/3010432c8edcfcbf95a9
To me, Featured Content is a flexible way to show one or many posts in one or many places in your theme. A blog might have 1 featured post area that will support 1-4 posts, as an example. A more complex site using WP as a CMS might program its homepage using many “featured areas” that contain varying numbers of post-like entities.
Featured Content, in the end, is just a way to return posts chosen by a content producer. The way in which featured content is selected should be intuitive, easy to manage, and use existing WP technology/terminology whenever possible. A featured post-like thing should an entity that points at a canonical post, while having the ability to override any of the parent post’s attributes on display. Example: I should be able to use a different title and image for a post that is featured when it is rendered in a featured area.
I should also be able to schedule featured items, much like I can schedule a post.
How are we going to implement it?
Here are my ideas:
I think we can get a lot of immediate mileage using a custom taxonomy, working name: “Featured Area” and a custom post type, working name: “Featured Item”. By default, a function like `wp_get_featured_content()` can return all featured posts. Passing a parameter can return posts matching that featured area slug that are published – `wp_get_featured_content( ‘mini-header’ )`. A custom taxonomy can be registered to post and featured_item. Themes can register the taxonomy for more post_types as necessary.
The plugin, in its current form, implements all of the above: https://wordpress.org/plugins/wp-featured-content/
Things to consider:
- How do we always keep the post and its featured_item brethren in sync?
- Do featured_items and posts always share the same post_status? Should they be independent?
- How do themes opt in to multiple featured areas if the terms have not be created for the featured_area taxonomy?
- What are alternate ways to implement the above?