By default when viewing a Post Type it is only the tree view that’s shown, with each entry Title. This decision was made so as to keep the interface as clean and streamlined as possible.
This is in stark contrast to the default WordPress Admin list tables which show many additional data columns by default, but are also cluttered by many plugins which insert additional data into the list.
OrganizeWP ships with a couple of Info Columns by default, but they are opt-in and must be enabled with a code snippet:
- Author (displays first and last initial(s))
- Modified time ago (displays full date on hover)
You can opt-in to the default Info Columns like so:
When these two Info Columns are enabled, they are displayed alongside each entry in the tree view:
Create Custom Info Columns
As is the case with the Entry Panel, Info Columns are completely customizable and it is straightforward to build your own. Info Columns can have their own markup and style, which make it a powerful way to customize your tree views in OrganizeWP!
Let’s create a custom Info Column that shows the Comment count for each entry. The first thing to do is build the class that’s going to output the HTML for each entry in the tree view when viewing a Post Type in OrganizeWP:
In this class we first define the
display() method which takes in the entry being displayed and expects us to return the markup to be output for this entry in this Info Column. In this case we’re outputting some HTML that contains the number of Comments for this entry.
We’ve also called another method in the Constructor,
assets(), which outputs some custom CSS we want to use that’s related to our custom Info Column.
With our custom Info Column defined, we now need to tell OrganizeWP to include it:
With those two snippets in place, we get a brand new Info Column that contains our custom markup and style!
Custom Info Columns in OrganizeWP are a fantastic way to custom build an interface that best suits the needs of your editors by surfacing the data you actually want to see every day as you’re editing the content on your site!