-
-
Notifications
You must be signed in to change notification settings - Fork 47
/
custom-post-type-permalinks.php
73 lines (63 loc) · 1.68 KB
/
custom-post-type-permalinks.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
<?php
/**
* Plugin Name: Custom Post Type Permalinks
* Plugin URI: https://github.com/torounit/custom-post-type-permalinks
* Description: Add post archives of custom post type and customizable permalinks.
* Author: Toro_Unit
* Author URI: https://torounit.com/
* Version: 3.5.3
* Text Domain: custom-post-type-permalinks
* License: GPL2 or later
* Domain Path: /language/
* Requires at least: 6.1
* Requires PHP: 7.4
*
* @package Custom_Post_Type_Permalinks
* @version 3.5.3
*/
define( 'CPTP_PLUGIN_FILE', __FILE__ );
define( 'CPTP_DEFAULT_PERMALINK', '/%postname%/' );
$cptp_data = get_file_data(
__FILE__,
array(
'Name' => 'Plugin Name',
'PluginURI' => 'Plugin URI',
'Version' => 'Version',
'Description' => 'Description',
'Author' => 'Author',
'AuthorURI' => 'Author URI',
'TextDomain' => 'Text Domain',
'DomainPath' => 'Domain Path',
'Network' => 'Network',
)
);
define( 'CPTP_VERSION', $cptp_data['Version'] );
define( 'CPTP_DOMAIN_PATH', $cptp_data['DomainPath'] );
define( 'CPTP_TEXT_DOMAIN', $cptp_data['TextDomain'] );
unset( $cptp_data );
/**
* Autoloader for CPTP.
*
* @since 1.0.0
*
* @param string $class_name class name.
*/
function cptp_class_loader( $class_name ) {
$file_name = __DIR__ . '/' . str_replace( '_', '/', $class_name ) . '.php';
if ( is_readable( $file_name ) ) {
include $file_name;
}
}
spl_autoload_register( 'cptp_class_loader' );
/**
* CPTP init.
*/
function cptp_init() {
$custom_post_type_permalinks = CPTP::get_instance();
$custom_post_type_permalinks->init();
}
cptp_init();
/**
* Activation hooks.
*/
register_activation_hook( CPTP_PLUGIN_FILE, array( CPTP::get_instance(), 'activate' ) );