I finally put a bunch of work into the coding of the plugin A plugin is a piece of software containing a group of functions that can be added to a WordPress website. They can extend functionality or add new features to your WordPress websites. WordPress plugins are written in the PHP programming language and integrate seamlessly with WordPress. These can be free in the WordPress.org Plugin Directory https://wordpress.org/plugins/ or can be cost-based plugin from a third-party, and I think it is fairly robust at this point. Whether it makes it into core Core is the set of software required to run WordPress. The Core Development Team builds WordPress. ( or whether it even should) is up for discussion, but I would like to share what I have.
First, check out the latest code in trunk A directory in Subversion containing the latest development code in preparation for the next major release cycle. If you are running "trunk", then you are on the latest revision. here: https://plugins.svn.wordpress.org/wp-featured-content/trunk/
To guide development, I made the following list of requirements. It should also be easier for people to follow along when we can all agree on an initial set of facts:
UI User interface
Wherever possible, existing WP functionality and screens will be used. The user should be able to associate posts with Featured Content theme areas as easy as selecting a category The 'category' taxonomy lets you group posts / content together that share a common bond. Categories are pre-defined and broad ranging. or making a post sticky, but, to be more robust, the user should be able to override certain features of a post when it is displayed as a Featured Item in a theme. Example: different title when featured vs what is displayed for a the full post, different image when in a featured module vs the featured image A featured image is the main image used on your blog archive page and is pulled when the post or page is shared on social media. The image can be used to display in widget areas on your site or in a summary list of posts. for the post when displayed in single.php.
Post Type / Taxonomy A taxonomy is a way to group things together. In WordPress, some common taxonomies are category, link, tag, or post format. https://codex.wordpress.org/Taxonomies#Default_Taxonomies.
- A Featured Item uses the featured_item post type
- A featured_item belongs to a Featured Area
- Each Featured Area is a term in the featured_area taxonomy
- Post types can opt in to featured content by adding featured_area taxonomy support
- Themes can opt-in by supporting ‘featured-content’ (the plugin currently brute-forces it)
Creating / Deleting
- Add a post with featured area(s), make sure featured item(s) are created
- Trash Trash in WordPress is like the Recycle Bin on your PC or Trash in your Macintosh computer. Users with the proper permission level (administrators and editors) have the ability to delete a post, page, and/or comments. When you delete the item, it is moved to the trash folder where it will remain for 30 days. the post, delete permanently, make sure featured item(s) are deleted
- Featured item should not have a title when created, it should inherit from the parent post when empty – view in list tables to verify
- If a featured item’s title is edited, it should show that in the list table, unless it is empty
- Add a post with a featured area, item is created. Edit post to belong to a featured area, 2nd featured item should be created.
- Delete one of the featured items, the other should remain, the post should be linked to only one featured area.
Transitioning Post Status
- Add a post in draft status, make sure featured item is in draft status
- Move a post in draft to publish, make sure featured item is moved as well
- If a post was created with 2 featured items and one is trashed: if the term is re-linked to the post, the item in the trash should be untrashed, instead of creating a 3rd item
Trash / Untrash
- Trash a post, make sure the featured item(s) are deleted
- Untrash a post, make sure the featured item(s) are not created
- Trash an existing featured item, make sure post loses tax association
- Untrash an existing featured item, make sure post regains tax association
- Permanently delete existing featured item, make sure post loses tax association
- The Taxonomy box for featured items should be present in Quick Edit
- All saving logic should fire in AJAX save routine for Quick Edit
- All featured items should be re-orderable via the Re-order items screen
- menu_order should be set when items are reordered, only those that change should be sent
- When new items are added to a featured area, they should be appended to the end of the list, not the beginning
- By default, featured item contains the post data of the post it belongs to
- If any fields have been overridden(post_title, post_excerpt), the post data is a merge of the 2
- If the featured item has a featured image, the theme can override by using the property ‘image_id’ to grab the featured image on one of the decorated $posts that is returned when applicable
Yeah, so that is a mouthful. All of these use-cases are listed in the comments at the top of the plugin file as well. There’s been a lot of discussion about new UI. If someone wants to think way outside of the box and introduce new screens, keep the above in mind.