Some of the locations of Ultimate Fields allow you to add additional columns to the listings of the types they are associated with.
- The Post Type location allows you to add columns to post listing screens.
- The Taxonomy location allows you to add columns to taxonomy lists.
- The User location allows you to add additional columns to user lists.
Adding additional columns to those listings/tables can let users get a better and quicker overview without having to enter idividual editing screens. For example, if you create a new Event post type, it would probably have "Event Start" and "Event End" fields associated with it. Since this is core information about the event, you might want to display it in the table.
In the UI
go to the "Columns" tab of any of the supported locations and add the columns, which you would like to use. For each column you can select:
- The field whose values should be displayed in the column.
- A position:
- append will add the column at the end of the table
- prepend will add the column in the absolute beginning of the table
- after title will display the column with high priority after the title, but will not move the title to the right.
- If you want the column to be sortable or not.
You can use the
admin_columns argument for the
$args array or the
add_admin_columns method of the location. Both of them expect a new
To create a new column you can use the static
$column = Admin_Column::create( 'event_start' );
Then you can use the following methods to set it up:
Each of the methods returns the column, so you can keep on using method chaining.
A complete example would look like this:
or like this if you are manually creating the location: