Skip to content

Commit

Permalink
Merge commit '073f531b062e3bfbf7b70e0e96b13c73a57c66f1' into trunk (S…
Browse files Browse the repository at this point in the history
…ee PR#31)
  • Loading branch information
ashfame committed Sep 10, 2024
2 parents e860b37 + 073f531 commit 5e25a77
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 0 deletions.
63 changes: 63 additions & 0 deletions src/plugin/class-liberation-engine.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<?php

class LiberationEngine {
const string POST_TYPE_POST = 'liberated_post';
const string POST_TYPE_PAGE = 'liberated_page';
const string POST_TYPE_PRODUCT = 'liberated_product';
const string POST_TYPE_NAVIGATION = 'liberated_navigation';

public function __construct() {
add_action( 'init', array( $this, 'register_post_types' ) );
}

public function register_post_types(): void {
register_post_type(
self::POST_TYPE_POST,
array(
'public' => false,
'label' => 'Liberated Post',
'show_in_rest' => true,
'rest_base' => 'liberated_posts',
'show_ui' => self::is_debug_mode(),
'show_in_menu' => self::is_debug_mode(),
)
);
register_post_type(
self::POST_TYPE_PAGE,
array(
'public' => false,
'label' => 'Liberated Page',
'show_in_rest' => true,
'rest_base' => 'liberated_pages',
'show_ui' => self::is_debug_mode(),
'show_in_menu' => self::is_debug_mode(),
)
);
register_post_type(
self::POST_TYPE_PRODUCT,
array(
'public' => false,
'label' => 'Liberated Product',
'show_in_rest' => true,
'rest_base' => 'liberated_products',
'show_ui' => self::is_debug_mode(),
'show_in_menu' => self::is_debug_mode(),
)
);
register_post_type(
self::POST_TYPE_NAVIGATION,
array(
'public' => false,
'label' => 'Liberated Navigation',
'show_in_rest' => true,
'rest_base' => 'liberated_navigations',
'show_ui' => self::is_debug_mode(),
'show_in_menu' => self::is_debug_mode(),
)
);
}

public function is_debug_mode(): bool {
return defined( 'WP_DEBUG' ) && WP_DEBUG;
}
}
3 changes: 3 additions & 0 deletions src/plugin/plugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,6 @@

// composer autoload.
require 'vendor/autoload.php';
require 'class-liberation-engine.php';

new LiberationEngine();

0 comments on commit 5e25a77

Please sign in to comment.