55 lines
1.7 KiB
PHP
55 lines
1.7 KiB
PHP
<?php
|
|
/**
|
|
* Plugin Name: 404 Enhancer
|
|
* Plugin URI: https://gitea.serverresources.info/d5admin/404-enhancer
|
|
* Description: Enhances the 404 page with a custom message, featured image, hand-picked content, a search form, URL-based suggestions, cross-links and a "did you mean" hint.
|
|
* Version: 0.3
|
|
* Requires at least: 6.0
|
|
* Requires PHP: 7.4
|
|
* Author: Duane Hass
|
|
* Text Domain: 404-enhancer
|
|
* Domain Path: /languages
|
|
*
|
|
* @package 404_Enhancer
|
|
*/
|
|
|
|
if ( ! defined( 'ABSPATH' ) ) {
|
|
exit;
|
|
}
|
|
|
|
define( 'FE_VERSION', '0.4' );
|
|
define( 'FE_PLUGIN_FILE', __FILE__ );
|
|
define( 'FE_PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
|
|
define( 'FE_PLUGIN_URL', plugin_dir_url( __FILE__ ) );
|
|
define( 'FE_SLUG', dirname( plugin_basename( __FILE__ ) ) );
|
|
|
|
require_once FE_PLUGIN_DIR . 'includes/class-fe-settings.php';
|
|
require_once FE_PLUGIN_DIR . 'includes/class-fe-suggestions.php';
|
|
require_once FE_PLUGIN_DIR . 'includes/class-fe-template.php';
|
|
require_once FE_PLUGIN_DIR . 'includes/class-fe-updater.php';
|
|
|
|
/**
|
|
* Loads the plugin text domain for translations.
|
|
*/
|
|
function fe_load_textdomain() {
|
|
load_plugin_textdomain( '404-enhancer', false, FE_SLUG . '/languages' );
|
|
}
|
|
add_action( 'plugins_loaded', 'fe_load_textdomain' );
|
|
|
|
/**
|
|
* Seeds default options on activation.
|
|
*/
|
|
function fe_activate() {
|
|
if ( false === get_option( 'fe_enabled_post_types' ) ) {
|
|
add_option( 'fe_enabled_post_types', array( 'post' ) );
|
|
}
|
|
if ( false === get_option( 'fe_suggestions_per_page' ) ) {
|
|
add_option( 'fe_suggestions_per_page', 6 );
|
|
}
|
|
}
|
|
register_activation_hook( __FILE__, 'fe_activate' );
|
|
|
|
FE_Settings::init();
|
|
FE_Template::init();
|
|
FE_Updater::init();
|