Created
January 25, 2022 13:58
-
-
Save hellofromtonya/9615b8a50928c0c8935949c53736785a to your computer and use it in GitHub Desktop.
Basic CPT plugin
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Test CPT with TT2. | |
* | |
* Plugin Name: Test CPT | |
* Plugin URI: https://github.com/tester/testcpt/ | |
* Description: Tests custom post type blank screen with TT2 | |
* Version: 1.0 | |
* Author: tester | |
* Author URI: https://github.com/tester/testcpt/ | |
* License: GPLv2 or later | |
* License URI: http://www.gnu.org/licenses/old-licenses/gpl-2.0.html | |
* Text Domain: testcpt | |
* Domain Path: /languages | |
* Requires at least: 4.9 | |
* Requires PHP: 5.6 or later | |
*/ | |
namespace TestCPT; | |
if ( ! defined( 'ABSPATH' ) ) { | |
die( 'Invalid request.' ); | |
} | |
function register_custom_post_type() { | |
register_post_type( 'testcpt', | |
array( | |
'labels' => array( | |
'name' => __( 'TestCPT', 'testcpt' ), | |
'singular_name' => __( 'TestCPT', 'testcpt' ), | |
), | |
'public' => true, | |
'has_archive' => true, | |
'show_in_rest' => true, | |
'rewrite' => array( 'slug' => 'testcpt' ) | |
) | |
); | |
} | |
add_action( 'init', __NAMESPACE__ . '\register_custom_post_type' ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment