PATH:
home
/
fengshp
/
www
/
wp-content
/
themes
/
themify-ultra
/
themify
<?php /** * Enable using a custom page as 404 page * * @package Themify_Builder * @subpackage Themify_Builder/classes */ class Themify_Custom_404 { private static $is_custom_404 = false; public static function init() { if ( is_404() && self::get_page() ) { /* do redirect_canonical early, handles all redirects needed for WP before changing the query */ redirect_canonical(); remove_filter( 'template_redirect', 'redirect_canonical' ); /* Redirection plugin, log 404 visits * @link https://wordpress.org/plugins/redirection/ */ if ( class_exists( 'Redirection', false ) ) { $module = Red_Module::get( WordPress_Module::MODULE_ID )->template_redirect(); } /* replace the 404 query with a custom WP_Query that displays the chosen page */ global $wp_query, $wp_the_query; $wp_query = $wp_the_query = self::get_404_query(); $posts = $wp_query->posts; $wp_query->rewind_posts(); self::$is_custom_404 = true; self::set_headers(); add_filter( 'body_class', [ __CLASS__, 'body_class' ] ); } } /** * Get the 404 page * * @return WP_Post|false */ public static function get_page() { static $id = null; if ( $id === null ) { $id = (int) themify_get( 'setting-page_404', false, true ); if ( $id !== 0 ) { $id = themify_maybe_translate_object_id( $id ); $id = ! empty( $id ) ? get_post( $id ) : false; } } return $id; } private static function get_404_query() { $query = new WP_Query(); $query->query( array( 'page_id' => self::get_page()->ID, 'suppress_filters' => true, ) ); $query->the_post(); return $query; } private static function set_headers() { status_header( 404 ); nocache_headers(); } public static function body_class( $classes ) { $classes[] = 'error404'; return $classes; } /** * Helper function, returns true only if is_404 and is using custom page * * @return bool */ public static function is_custom_404() { return self::$is_custom_404 === true; } } add_action( 'template_redirect', [ 'Themify_Custom_404', 'init' ], 0 );
[+]
..
[+]
js
[-] class-tf-term-image.php
[edit]
[-] themify-import-functions.php
[edit]
[-] class-themify-enqueue.php
[edit]
[-] themify-hooks.php
[edit]
[-] class-themify-storage.php
[edit]
[+]
themify-icon-picker
[-] class-themify-child-theme-generator.php
[edit]
[-] class-themify-menu-toggle-dropdown.php
[edit]
[+]
google-fonts
[-] themify-widgets.php
[edit]
[-] themify-microdata.php
[edit]
[+]
themify-builder
[-] themify-theme-filters.php
[edit]
[+]
megamenu
[-] class-cpt.php
[edit]
[-] class-themify-custom-404.php
[edit]
[-] themify-status.php
[edit]
[-] class-themify-maintenance-mode.php
[edit]
[-] themify-template-tags.php
[edit]
[-] themify-config.php
[edit]
[-] class-themify-access-role.php
[edit]
[+]
themify-metabox
[+]
customizer
[+]
cache
[-] themify-wpajax.php
[edit]
[+]
img
[-] img.php
[edit]
[-] class-themify-custom-fonts.php
[edit]
[+]
plugin-compat
[-] class-themify-menu-icons.php
[edit]
[-] class-themify-filesystem.php
[edit]
[-] class-themify-mobile-detect.php
[edit]
[-] themify-fw-filters.php
[edit]
[-] class-hook-contents.php
[edit]
[-] themify-utils.php
[edit]
[-] class-tgm-plugin-activation.php
[edit]
[-] themify-admin.php
[edit]
[-] class-themify-get-image-size.php
[edit]
[-] themify-startup-check.php
[edit]
[+]
includes
[+]
.data
[-] themify-database.php
[edit]
[+]
css
[+]
themify-icons