| Server IP : 157.230.181.24 / Your IP : 216.73.217.11 Web Server : Apache/2.4.58 (Ubuntu) System : Linux conductive 6.8.0-117-generic #117-Ubuntu SMP PREEMPT_DYNAMIC Tue May 5 19:26:24 UTC 2026 x86_64 User : ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/vhosts/conductive-digital/app/providers/ |
Upload File : |
<?php
namespace Theme\Providers;
use Themosis\Facades\PostType;
use Themosis\Foundation\ServiceProvider;
class CustomPostTypesProvider extends ServiceProvider {
/**
* Fire!
*/
public function register() {
$theme = container();
// Get the post-types.config.php
$postTypes = $theme['config.factory']->get('post-types');
// Register each post type from the config
foreach($postTypes as $key => $postType) {
// Automatically generate labels
$data = array_merge([
'labels' => [
'name' => $postType['name'],
'singular_name' => $postType['singular_name'],
'menu_name' => $postType['name'],
'name_admin_bar' => $postType['singular_name'],
'add_new' => "Add New",
'add_new_item' => "Add New {$postType['singular_name']}",
'new_item' => "New {$postType['singular_name']}",
'edit_item' => "Edit {$postType['singular_name']}",
'view_item' => "View {$postType['singular_name']}",
'all_items' => "All {$postType['name']}",
'search_items' => "Search {$postType['name']}",
'parent_item_colon' => "Parent {$postType['name']}:",
'not_found' => "No {$postType['name']} found.",
'not_found_in_trash' => "No {$postType['name']} found in Trash.",
],
], $postType['data']);
PostType::make($key, $postType['name'], $postType['singular_name'])->set($data);
}
}
}