custom-post-type-permalinks
Last commit date
CPTP
7 years ago
assets
8 years ago
language
8 years ago
CONTRIBUTING.md
9 years ago
CPTP.php
8 years ago
LICENSE
9 years ago
custom-post-type-permalinks.php
7 years ago
readme.md
7 years ago
readme.txt
7 years ago
screenshot-1.png
14 years ago
custom-post-type-permalinks.php
69 lines
| 1 | <?php |
| 2 | /** |
| 3 | * Plugin Name: Custom Post Type Permalinks |
| 4 | * Plugin URI: https://github.com/torounit/custom-post-type-permalinks |
| 5 | * Description: Add post archives of custom post type and customizable permalinks. |
| 6 | * Author: Toro_Unit |
| 7 | * Author URI: https://torounit.com/ |
| 8 | * Version: 3.3.1 |
| 9 | * Text Domain: custom-post-type-permalinks |
| 10 | * License: GPL2 or later |
| 11 | * Domain Path: /language/ |
| 12 | * |
| 13 | * @package Custom_Post_Type_Permalinks |
| 14 | * @version 3.3.1 |
| 15 | */ |
| 16 | |
| 17 | define( 'CPTP_PLUGIN_FILE', __FILE__ ); |
| 18 | define( 'CPTP_DEFAULT_PERMALINK', '/%postname%/' ); |
| 19 | |
| 20 | $cptp_data = get_file_data( __FILE__, array( |
| 21 | 'Name' => 'Plugin Name', |
| 22 | 'PluginURI' => 'Plugin URI', |
| 23 | 'Version' => 'Version', |
| 24 | 'Description' => 'Description', |
| 25 | 'Author' => 'Author', |
| 26 | 'AuthorURI' => 'Author URI', |
| 27 | 'TextDomain' => 'Text Domain', |
| 28 | 'DomainPath' => 'Domain Path', |
| 29 | 'Network' => 'Network', |
| 30 | ) ); |
| 31 | |
| 32 | define( 'CPTP_VERSION', $cptp_data['Version'] ); |
| 33 | define( 'CPTP_DOMAIN_PATH', $cptp_data['DomainPath'] ); |
| 34 | define( 'CPTP_TEXT_DOMAIN', $cptp_data['TextDomain'] ); |
| 35 | |
| 36 | |
| 37 | /** |
| 38 | * Autoloader for CPTP. |
| 39 | * |
| 40 | * @since 1.0.0 |
| 41 | * |
| 42 | * @param string $class_name class name. |
| 43 | */ |
| 44 | function cptp_class_loader( $class_name ) { |
| 45 | $dir = dirname( __FILE__ ); |
| 46 | $file_name = $dir . '/' . str_replace( '_', '/', $class_name ) . '.php'; |
| 47 | if ( is_readable( $file_name ) ) { |
| 48 | include $file_name; |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | spl_autoload_register( 'cptp_class_loader' ); |
| 53 | |
| 54 | /** |
| 55 | * CPTP init. |
| 56 | */ |
| 57 | function cptp_init() { |
| 58 | $custom_post_type_permalinks = CPTP::get_instance(); |
| 59 | $custom_post_type_permalinks->init(); |
| 60 | } |
| 61 | |
| 62 | cptp_init(); |
| 63 | |
| 64 | /** |
| 65 | * Activation hooks. |
| 66 | */ |
| 67 | register_activation_hook( CPTP_PLUGIN_FILE, array( CPTP::get_instance(), 'activate' ) ); |
| 68 | |
| 69 |