';
echo $ui->get_button( // phpcs:ignore.
[
'id' => 'cptui_choose_dashicon',
'classes' => 'dashicons-picker',
'textvalue' => esc_attr__( 'Choose dashicon', 'custom-post-type-ui' ),
]
);
echo '
';
echo $ui->get_button( // phpcs:ignore.
[
'id' => 'cptui_choose_icon',
'textvalue' => esc_attr__( 'Choose image icon', 'custom-post-type-ui' ),
]
);
echo '
';
echo $ui->get_td_end() . $ui->get_tr_end(); // phpcs:ignore.
echo $ui->get_text_input( // phpcs:ignore.
[
'namearray' => 'cpt_custom_post_type',
'name' => 'register_meta_box_cb',
'textvalue' => isset( $current['register_meta_box_cb'] ) ? esc_attr( $current['register_meta_box_cb'] ) : '', // phpcs:ignore.
'labeltext' => esc_html__( 'Metabox callback', 'custom-post-type-ui' ),
'helptext' => esc_html__( 'Provide a callback function that sets up the meta boxes for the edit form. Do `remove_meta_box()` and `add_meta_box()` calls in the callback. Default null.', 'custom-post-type-ui' ),
]
);
echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Supports', 'custom-post-type-ui' ); // phpcs:ignore.
echo $ui->get_p( esc_html__( 'Add support for various available post editor features on the right. A checked value means the post type feature is supported.', 'custom-post-type-ui' ) ); // phpcs:ignore.
echo $ui->get_p( esc_html__( 'Use the "None" option to explicitly set "supports" to false.', 'custom-post-type-ui' ) ); // phpcs:ignore.
echo $ui->get_p( esc_html__( 'Featured images and Post Formats need theme support added, to be used.', 'custom-post-type-ui' ) ); // phpcs:ignore.
echo $ui->get_p( // phpcs:ignore.
sprintf(
'
%s%s',
esc_url( 'https://developer.wordpress.org/reference/functions/add_theme_support/#post-thumbnails' ),
/* translators: Link text for WordPress Developer site. */
esc_html__( 'Theme support for featured images', 'custom-post-type-ui' ),
esc_url( 'https://developer.wordpress.org/advanced-administration/wordpress/post-formats/' ),
/* translators: Link text for WordPress Developer site. */
esc_html__( 'Theme support for post formats', 'custom-post-type-ui' )
)
);
echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start(); // phpcs:ignore.
echo $ui->get_legend_start() . esc_html__( 'Post type options', 'custom-post-type-ui' ) . $ui->get_legend_end(); // phpcs:ignore.
$title_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'title', $current['supports'] ) ) ? 'true' : 'false'; // phpcs:ignore.
if ( 'new' === $tab ) {
$title_checked = 'true';
}
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'title',
'checked' => $title_checked, // phpcs:ignore.
'name' => 'title',
'namearray' => 'cpt_supports',
'textvalue' => 'title',
'labeltext' => esc_html__( 'Title', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
$editor_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'editor', $current['supports'] ) ) ? 'true' : 'false'; // phpcs:ignore.
if ( 'new' === $tab ) {
$editor_checked = 'true';
}
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'editor',
'checked' => $editor_checked, // phpcs:ignore.
'name' => 'editor',
'namearray' => 'cpt_supports',
'textvalue' => 'editor',
'labeltext' => esc_html__( 'Editor', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
$thumb_checked = ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'thumbnail', $current['supports'] ) ) ? 'true' : 'false'; // phpcs:ignore.
if ( 'new' === $tab ) {
$thumb_checked = 'true';
}
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'thumbnail',
'checked' => $thumb_checked, // phpcs:ignore.
'name' => 'thumbnail',
'namearray' => 'cpt_supports',
'textvalue' => 'thumbnail',
'labeltext' => esc_html__( 'Featured Image', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'excerpt',
'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'excerpt', $current['supports'] ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'excerpts',
'namearray' => 'cpt_supports',
'textvalue' => 'excerpt',
'labeltext' => esc_html__( 'Excerpt', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'trackbacks',
'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'trackbacks', $current['supports'] ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'trackbacks',
'namearray' => 'cpt_supports',
'textvalue' => 'trackbacks',
'labeltext' => esc_html__( 'Trackbacks', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'custom-fields',
'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'custom-fields', $current['supports'] ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'custom-fields',
'namearray' => 'cpt_supports',
'textvalue' => 'custom-fields',
'labeltext' => esc_html__( 'Custom Fields', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'comments',
'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'comments', $current['supports'] ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'comments',
'namearray' => 'cpt_supports',
'textvalue' => 'comments',
'labeltext' => esc_html__( 'Comments', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'revisions',
'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'revisions', $current['supports'] ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'revisions',
'namearray' => 'cpt_supports',
'textvalue' => 'revisions',
'labeltext' => esc_html__( 'Revisions', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'author',
'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'author', $current['supports'] ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'author',
'namearray' => 'cpt_supports',
'textvalue' => 'author',
'labeltext' => esc_html__( 'Author', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'page-attributes',
'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'page-attributes', $current['supports'] ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'page-attributes',
'namearray' => 'cpt_supports',
'textvalue' => 'page-attributes',
'labeltext' => esc_html__( 'Page Attributes', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'post-formats',
'checked' => ( ! empty( $current['supports'] ) && is_array( $current['supports'] ) && in_array( 'post-formats', $current['supports'] ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'post-formats',
'namearray' => 'cpt_supports',
'textvalue' => 'post-formats',
'labeltext' => esc_html__( 'Post Formats', 'custom-post-type-ui' ),
'default' => true,
'wrap' => false,
]
);
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => 'none',
'checked' => ( ! empty( $current['supports'] ) && ( is_array( $current['supports'] ) && in_array( 'none', $current['supports'] ) ) ) ? 'true' : 'false', // phpcs:ignore.
'name' => 'none',
'namearray' => 'cpt_supports',
'textvalue' => 'none',
'labeltext' => esc_html__( 'None', 'custom-post-type-ui' ),
'default' => false,
'wrap' => false,
]
);
echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end(); // phpcs:ignore.
echo $ui->get_tr_start() . $ui->get_th_start() . '
'; // phpcs:ignore.
echo $ui->get_p( sprintf( esc_html__( 'Use this input to register custom "supports" values, separated by commas. Learn about this at %s', 'custom-post-type-ui' ), '
' . esc_html__( 'Custom "Supports"', 'custom-post-type-ui' ) . '' ) ); // phpcs:ignore.
echo $ui->get_th_end() . $ui->get_td_start(); // phpcs:ignore.
echo $ui->get_text_input( // phpcs:ignore.
[
'namearray' => 'cpt_custom_post_type',
'name' => 'custom_supports',
'textvalue' => isset( $current['custom_supports'] ) ? esc_attr( $current['custom_supports'] ) : '', // phpcs:ignore.
'helptext' => esc_attr__( 'Provide custom support slugs here.', 'custom-post-type-ui' ),
'helptext_after' => true,
'wrap' => false,
]
);
echo $ui->get_td_end() . $ui->get_tr_end(); // phpcs:ignore.
echo $ui->get_tr_start() . $ui->get_th_start() . esc_html__( 'Taxonomies', 'custom-post-type-ui' ); // phpcs:ignore.
echo $ui->get_p( esc_html__( 'Add support for available registered taxonomies.', 'custom-post-type-ui' ) ); // phpcs:ignore.
echo $ui->get_th_end() . $ui->get_td_start() . $ui->get_fieldset_start(); // phpcs:ignore.
echo $ui->get_legend_start() . esc_html__( 'Taxonomy options', 'custom-post-type-ui' ) . $ui->get_legend_end(); // phpcs:ignore.
/**
* Filters the arguments for taxonomies to list for post type association.
*
* @since 1.0.0
*
* @param array $value Array of default arguments.
*/
$args = apply_filters( 'cptui_attach_taxonomies_to_post_type', [ 'public' => true ] );
// If they don't return an array, fall back to the original default. Don't need to check for empty, because empty array is default for $args param in get_post_types anyway.
if ( ! is_array( $args ) ) {
$args = [ 'public' => true ];
}
/**
* Filters the results returned to display for available taxonomies for post type.
*
* @since 1.6.0
*
* @param array $value Array of taxonomy objects.
* @param array $args Array of arguments for the taxonomies query.
*/
$add_taxes = apply_filters( 'cptui_get_taxonomies_for_post_types', get_taxonomies( $args, 'objects' ), $args );
unset( $add_taxes['nav_menu'], $add_taxes['post_format'] );
foreach ( $add_taxes as $add_tax ) {
if ( false !== $add_tax ) {
$core_label = in_array( $add_tax->name, [
'category',
'post_tag'
], true ) ? esc_html__( '(WP Core)', 'custom-post-type-ui' ) : '';
echo $ui->get_check_input( // phpcs:ignore.
[
'checkvalue' => esc_attr( $add_tax->name ),
'checked' => ( ! empty( $current['taxonomies'] ) && is_array( $current['taxonomies'] ) && in_array( $add_tax->name, $current['taxonomies'] ) ) ? 'true' : 'false',
// phpcs:ignore.
'name' => esc_attr( $add_tax->name ),
'namearray' => 'cpt_addon_taxes',
'textvalue' => esc_attr( $add_tax->name ),
'labeltext' => esc_html( $add_tax->label . ' ' . $core_label ),
// phpcs:ignore.
'helptext' => sprintf( esc_attr__( 'Adds %s support', 'custom-post-type-ui' ), $add_tax->label ),
// phpcs:ignore.
'wrap' => false,
]
);
}
}
echo $ui->get_fieldset_end() . $ui->get_td_end() . $ui->get_tr_end(); // phpcs:ignore.
?>