PluginProbe
Display Post Types – Post Grid, post list and post sliders / 2.1.0
Display Post Types – Post Grid, post list and post sliders v2.1.0
3.4.3 3.4.2 3.4.1 3.4.0 trunk 1.0 1.1 1.2 1.3 1.4 1.5 1.6.0 1.7.0 1.8.0 1.9.0 2.0.0 2.1.0 2.2.0 2.3.0 2.4.0 2.4.1 2.5.0 2.6.0 2.6.1 2.6.2 All 49 releases
display-post-types / display-post-types.php

display-post-types.php in Display Post Types – Post Grid, post list and post sliders 2.1.0, at display-post-types.php

99 lines 2.5 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * The plugin bootstrap file
4 *
5 * This file is read by WordPress to generate the plugin information in the plugin
6 * admin area. This file also includes all of the dependencies used by the plugin,
7 * registers the activation and deactivation functions, and defines a function
8 * that starts the plugin.
9 *
10 * @link https://vedathemes.com
11 * @since 1.0.0
12 * @package Display_Post_Types
13 *
14 * @wordpress-plugin
15 * Plugin Name: Display Post Types
16 * Description: Filter, sort and display post, page or any post type.
17 * Version: 2.1.0
18 * Author: vedathemes
19 * Author URI: https://vedathemes.com
20 * License: GPL-3.0+
21 * License URI: http://www.gnu.org/licenses/gpl-3.0.txt
22 * Text Domain: display-post-types
23 * Domain Path: /lang
24 */
25
26 // If this file is called directly, abort.
27 if ( ! defined( 'WPINC' ) ) {
28 die;
29 }
30
31 // Currently plugin version.
32 define( 'DISPLAY_POST_TYPES_VERSION', '2.1.0' );
33
34 // Define plugin constants.
35 define( 'DISPLAY_POST_TYPES_DIR', plugin_dir_path( __FILE__ ) );
36
37 // Define plugin constants.
38 define( 'DISPLAY_POST_TYPES_URL', plugin_dir_url( __FILE__ ) );
39
40 // Define plugin constants.
41 define( 'DISPLAY_POST_TYPES_BASENAME', plugin_basename( __FILE__ ) );
42
43 // Register PHP autoloader.
44 spl_autoload_register(
45 function( $class ) {
46 $namespace = 'Display_Post_Types\\';
47
48 // Bail if the class is not in our namespace.
49 if ( 0 !== strpos( $class, $namespace ) ) {
50 return;
51 }
52
53 // Get classname without namespace.
54 $carray = array_values( explode( '\\', $class ) );
55 $clast = count( $carray ) - 1;
56
57 // Return if proper array is not available. (Just in case).
58 if ( ! $clast ) {
59 return;
60 }
61
62 // Prepend actual classname with 'class-' prefix.
63 $carray[ $clast ] = 'class-' . $carray[ $clast ];
64 $class = implode( '\\', $carray );
65
66 // Generate file path from classname.
67 $path = strtolower(
68 str_replace(
69 array( $namespace, '_' ),
70 array( '', '-' ),
71 $class
72 )
73 );
74
75 // Build full filepath.
76 $file = DISPLAY_POST_TYPES_DIR . DIRECTORY_SEPARATOR . str_replace( '\\', DIRECTORY_SEPARATOR, $path ) . '.php';
77
78 // If the file exists for the class name, load it.
79 if ( file_exists( $file ) ) {
80 include $file;
81 }
82 }
83 );
84
85 add_action(
86 'plugins_loaded',
87 function() {
88 // Load plugin's text domain.
89 load_plugin_textdomain( 'display-post-types', false, DISPLAY_POST_TYPES_DIR . 'lang/' );
90
91 // Register Podcast player front-end hooks.
92 Display_Post_Types\Frontend\Register::init();
93
94 // Register Podcast player back-end hooks.
95 Display_Post_Types\Backend\Register::init();
96 },
97 8
98 );
99