/** * Get list of custom post type names which need an archive settings page. * * @since 2.0.0 * * @uses genesis_get_cpt_archive_types() Get list of custom post type objects which need an archive settings page. * * @return array Custom post type names. */ function genesis_get_cpt_archive_types_names() { $post_type_names = array(); foreach (genesis_get_cpt_archive_types() as $post_type) { $post_type_names[] = $post_type->name; } return $post_type_names; }
/** * Add archive settings page to relevant custom post type registrations. * * An instance of `Genesis_Admin_CPT_Archive_Settings` is instantiated for each relevant CPT, assigned to an individual * global variable. * * @since 2.0.0 * * @uses \Genesis_Admin_CPT_Archive_Settings CPT Archive Settings page class. * @uses genesis_get_cpt_archive_types() Get list of custom post types which need an archive settings page. * @uses genesis_has_post_type_archive_support() Check post type has archive support. */ function genesis_add_cpt_archive_page() { $post_types = genesis_get_cpt_archive_types(); foreach ($post_types as $post_type) { if (genesis_has_post_type_archive_support($post_type->name)) { $admin_object_name = '_genesis_admin_cpt_archives_' . $post_type->name; global ${$admin_object_name}; ${$admin_object_name} = new Genesis_Admin_CPT_Archive_Settings($post_type); } } }