Skip to content

Features Overview

Carlos Moreira edited this page Jun 2, 2020 · 2 revisions

The features parameter enhances the user interface of the administration of your Custom Post Type. Saltus offers several features. Some of them you just need to enable them with a simple true value, others might need more information.

Currently Saltus includes the following features:

  • dragAndDrop - will allow you to enable drag&drop in the admnistration list of entries to control the order of your custom post type entries;
  • duplicate - will add an extra action for each entry in the admnistration list to easily duplicate an existing entry;
  • single_export - will add an option in the edit screen of each entry to download a XML export file containing only that entry;
  • admin_cols - adds custom columns to the administration list of entries;
  • admin_filters - adds custom filters to the administration list of entries;

Example:

return [
	'active'       => true,
	'type'         => 'cpt',
	'name'         => 'book',
	'features'     => [
		'dragAndDrop'   => true,
		'duplicate'     => true,
		'single_export' => true,
		'admin_cols'    => array(
			'featured_image' => array(
				'title'          => 'Image',
				'featured_image' => 'thumbnail',
			),
			'title',
			'genre'          => array(
				'taxonomy' => 'genre',
			),
			'writer'         => array(
				'taxonomy' => 'writer',
			),
			'author'         => array(
				'title'      => 'Entry Author',
				'post_field' => 'post_author',
			),
			'id'             => array(
				'title'      => 'ID',
				'post_field' => 'ID',
			),
			'shortcode'      => array(
				'title'    => __( 'Shortcode', 'framework-demo' ),
				'function' => function() {
					global $post;
					echo esc_html( '[display-book id="' . $post->ID . '"]' );
				},
			),
		),
		'admin_filters' => array(
			'genres'  => array(
				'taxonomy' => 'genre',
			),
			'writers' => array(
				'taxonomy' => 'writer',
			),
		),
	],
];