/** * CONSTRUCTOR * * This function automatically runs when the class is instantiated * All of the plugin setup kooks go here * * @since 1.0.0 */ private function __construct($version, $plugin_path, $plugin_url, $plugin_file) { //Assign the class variables self::$version = $version; self::$plugin_path = $plugin_path; self::$plugin_url = $plugin_url; self::$plugin_file = $plugin_file; // Include required files require_once $plugin_path . 'includes/class-metabox-field.php'; require_once $plugin_path . 'includes/class-custom-admin-column.php'; // Register the deactivation hook register_deactivation_hook($plugin_path . $plugin_file, array($this, 'deactivation')); // Schedule the cron to check the sticky expiration if (!wp_next_scheduled('spe_sticky_expiration')) { wp_schedule_event(time(), 'twicedaily', 'spe_sticky_expiration'); } add_action('spe_sticky_expiration', array($this, 'check_sticky_expiration')); add_action('admin_footer', array($this, 'check_sticky_expiration')); }
<?php /* Plugin Name: Sticky Post Expiration * Plugin URI: http://ebenhale.com/sticky-post-expiration * Version: 1.0.0 * Description: This WordPress plugin allows the user to set a sticky post expiration date * Author: Eben Hale * Author URI: http://ebenhale.com/ * License: GPL-2.0+ * License URI: http://www.gnu.org/licenses/gpl-2.0.txt * */ /* * Exit if called directly. */ if (!defined('WPINC')) { die; } require_once 'includes/class-sticky-post-expiration.php'; Sticky_Post_Expiration::instance('1.0.0', plugin_dir_path(__FILE__), plugin_dir_url(__FILE__), plugin_basename(__DIR__) . '.php');