404page – your smart custom 404 error page - Version 6

Version Description

exclude 404 page from XML sitemap generated by Yoast SEO

Download this release

Release Info

Developer petersplugins
Plugin Icon 128x128 404page – your smart custom 404 error page
Version 6
Comparing to
See all releases

Code changes from version 5 to 6

404page.php CHANGED
@@ -9,7 +9,7 @@
9
* Plugin Name: 404page - your smart custom 404 error page
10
* Plugin URI: https://petersplugins.com/free-wordpress-plugins/404page/
11
* Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
12
- * Version: 5
13
* Author: Peter Raschendorfer
14
* Author URI: https://petersplugins.com
15
* Text Domain: 404page
@@ -32,7 +32,7 @@ $pp_404page = new PP_404Page( array(
32
'file' => __FILE__,
33
'slug' => pathinfo( __FILE__, PATHINFO_FILENAME ),
34
'name' => '404page - your smart custom 404 error page',
35
- 'version' => '5'
36
)
37
);
38
9
* Plugin Name: 404page - your smart custom 404 error page
10
* Plugin URI: https://petersplugins.com/free-wordpress-plugins/404page/
11
* Description: Custom 404 the easy way! Set any page as custom 404 error page. No coding needed. Works with (almost) every Theme.
12
+ * Version: 6
13
* Author: Peter Raschendorfer
14
* Author URI: https://petersplugins.com
15
* Text Domain: 404page
32
'file' => __FILE__,
33
'slug' => pathinfo( __FILE__, PATHINFO_FILENAME ),
34
'name' => '404page - your smart custom 404 error page',
35
+ 'version' => '6'
36
)
37
);
38
assets/css/404page-ui.css CHANGED
@@ -1,37 +1,3 @@
1
- #pp-404page-settings h1 {
2
- margin-bottom: 40px;
3
- }
4
-
5
- #pp-plugin-info-404page {
6
- min-height: 48px;
7
- line-height: 48px;
8
- vertical-align: middle;
9
- padding-left: 60px;
10
- background-repeat: no-repeat;
11
- background-position: left center;
12
- }
13
-
14
- .rtl #pp-plugin-info-404page {
15
- padding-left: 0;
16
- padding-right: 60px;
17
- background-position: right center;
18
- }
19
-
20
- #pp-plugin-info-404page span {
21
- float: right;
22
- padding-left: 50px;
23
- }
24
-
25
- .rtl #pp-plugin-info-404page span {
26
- float: left;
27
- padding-left: 0;
28
- padding-right: 50px;
29
- }
30
-
31
- #pp-plugin-info-404page .dashicons {
32
- vertical-align: middle;
33
- }
34
-
35
#select404page {
36
width: 100%;
37
}
@@ -57,7 +23,7 @@
57
margin-bottom: 20px;
58
}
59
60
- #pp-seetings-advanced .form-table th {
61
display: none;
62
}
63
1
#select404page {
2
width: 100%;
3
}
23
margin-bottom: 20px;
24
}
25
26
+ #pp-settings-advanced .form-table th {
27
display: none;
28
}
29
assets/css/pp-admin-page.css ADDED
@@ -0,0 +1,55 @@
1
+ .pp-admin-page-wrapper h1>span {
2
+ display: block;
3
+ line-height: 48px;
4
+ padding-left: 60px;
5
+ background-image: url(../img/pluginicon.png);
6
+ background-repeat: no-repeat;
7
+ background-color: #4B6F87;
8
+ color: #fff;
9
+ }
10
+
11
+ .rtl .pp-admin-page-wrapper h1>span {
12
+ padding-left: 0;
13
+ padding-right: 60px;
14
+ background-position: right top;
15
+ }
16
+
17
+ .pp-admin-page-wrapper h1 nav {
18
+ text-align: right;
19
+ line-height: 1;
20
+ border-right: 1px solid #4B6F87;
21
+ }
22
+
23
+ .rtl .pp-admin-page-wrapper h1 nav {
24
+ text-align: left;
25
+ }
26
+
27
+ .pp-admin-page-wrapper h1 nav a {
28
+ display: inline-block;
29
+ padding: 6px;
30
+ color: #4B6F87;
31
+ background-color: #fff;
32
+ text-decoration: none;
33
+ font-size: 12px;
34
+ height: 20px;
35
+ line-height: 20px;
36
+ border-left: 1px solid #4B6F87;
37
+ border-bottom: 1px solid #4B6F87;
38
+ }
39
+
40
+ .pp-admin-page-wrapper h1 nav a span.text {
41
+ white-space: nowrap;
42
+ padding-left: 4px;
43
+ display: none;
44
+ }
45
+
46
+ @media only screen and (min-width: 1200px) {
47
+ .pp-admin-page-wrapper h1 nav a span.text {
48
+ display: inline;
49
+ }
50
+ }
51
+
52
+ .pp-admin-page-wrapper h1 nav a:hover, .pp-admin-page-wrapper h1 nav a:focus {
53
+ background-color: #4B6F87;
54
+ color: #fff;
55
+ }
assets/img/index.php ADDED
@@ -0,0 +1 @@
1
+ <?php // Silence is golden
assets/{pluginicon.png → img/pluginicon.png} RENAMED
File without changes
inc/class-404page.php CHANGED
@@ -108,6 +108,17 @@ if ( !class_exists( 'PP_404Page' ) ) {
108
add_filter( 'redirect_canonical' ,array ( $this, 'no_url_guessing' ) );
109
}
110
111
} else {
112
113
add_action( 'admin_init', array( $this, 'admin_init' ) );
@@ -576,39 +587,6 @@ if ( !class_exists( 'PP_404Page' ) ) {
576
*/
577
function admin_style() {
578
579
- if ( get_current_screen()->id == $this->admin_handle ) {
580
-
581
- ?>
582
- <style type="text/css">
583
- #pp-404page-settings h1 span {
584
- display: block;
585
- line-height: 48px;
586
- padding-left: 60px;
587
- background-image: url(<?php echo plugins_url( 'assets/pluginicon.png', $this->_file ); ?>);
588
- background-repeat: no-repeat;
589
- background-color: #4B6F87;
590
- color: #fff;
591
- }
592
- #pp-404page-settings h1 nav {
593
- background-color: #fff;
594
- text-align: right;
595
- line-height: 1;
596
- }
597
- #pp-404page-settings h1 nav a {
598
- display: inline-block;
599
- padding: 6px;
600
- color: #4B6F87;
601
- }
602
- #pp-404page-settings h1 nav a:hover, #pp-404page-settings h1 nav a:focus {
603
- color: #104060;
604
- }
605
-
606
- </style>
607
-
608
- <?php
609
-
610
- }
611
-
612
if ( $this->settings['404page_page_id'] > 0 ) {
613
614
echo '<style type="text/css">';
@@ -1069,6 +1047,7 @@ if ( !class_exists( 'PP_404Page' ) ) {
1069
1070
if ( get_current_screen()->id == $this->admin_handle ) {
1071
1072
wp_enqueue_style( '404pagecss', plugins_url( 'assets/css/404page-ui.css', $this->_file ) );
1073
1074
}
@@ -1103,17 +1082,57 @@ if ( !class_exists( 'PP_404Page' ) ) {
1103
1104
}
1105
?>
1106
- <div class="wrap 404page" id="pp-404page-settings">
1107
<h1>
1108
<span><?php echo $this->plugin_name; ?></span>
1109
- <nav><a class="dashicons dashicons-star-filled" href="https://wordpress.org/support/plugin/<?php echo $this->plugin_slug; ?>/reviews/" title="<?php _e( 'Please rate plugin', '404page' ); ?>"></a><a class="dashicons dashicons-wordpress" href="<?php echo $this->wp_url; ?>/" title="<?php _e( 'wordpress.org plugin directory', '404page' ); ?>"></a><a class="dashicons dashicons-admin-home" href="https://petersplugins.com/" title="<?php _e( 'Author homepage', '404page' );?>"></a><a class="dashicons dashicons-googleplus" href="https://plus.google.com/+petersplugins" title="<?php _e( 'Authors Google+ Page', '404page' ); ?>"></a><a class="dashicons dashicons-facebook-alt" href="https://www.facebook.com/petersplugins/" title="<?php _e( 'Authors facebook Page', '404page' ); ?>"></a><a class="dashicons dashicons-book-alt" href="<?php echo $this->dc_url; ?>" title="<?php _e( 'Plugin Doc', '404page' ); ?>"></a><a class="dashicons dashicons-editor-help" href="https://wordpress.org/support/plugin/<?php echo $this->plugin_slug; ?>/" title="<?php _e( 'Support', '404page'); ?>"></a><a class="dashicons dashicons-admin-comments" href="https://petersplugins.com/contact/" title="<?php _e( 'Contact Author', '404page' ); ?>"></a></span>
1110
</h1>
1111
<?php settings_errors(); ?>
1112
<form method="post" action="options.php">
1113
<?php settings_fields( '404page_settings' ); ?>
1114
<?php do_settings_sections( '404page_settings_section' ); ?>
1115
- <div id="pp-seetings-advanced">
1116
- <h3>Advanced Settings</h3>
1117
<?php do_settings_sections( '404page_settings_section_advanced' ); ?>
1118
</div>
1119
<?php submit_button(); ?>
@@ -1123,6 +1142,21 @@ if ( !class_exists( 'PP_404Page' ) ) {
1123
}
1124
1125
1126
/**
1127
* show admin notices
1128
*/
108
add_filter( 'redirect_canonical' ,array ( $this, 'no_url_guessing' ) );
109
}
110
111
+ // Remove 404 error page from YOAST sitemap
112
+ // only if "Send an 404 error if the page is accessed directly by its URL" is active
113
+ // @since 6
114
+ if ( $this->settings['404page_fire_error'] ) {
115
+
116
+ add_filter( 'wpseo_exclude_from_sitemap_by_post_ids', function () {
117
+ return array( $this->settings['404page_page_id'] );
118
+ } );
119
+
120
+ }
121
+
122
} else {
123
124
add_action( 'admin_init', array( $this, 'admin_init' ) );
587
*/
588
function admin_style() {
589
590
if ( $this->settings['404page_page_id'] > 0 ) {
591
592
echo '<style type="text/css">';
1047
1048
if ( get_current_screen()->id == $this->admin_handle ) {
1049
1050
+ wp_enqueue_style( 'pp-admin-page', plugins_url( 'assets/css/pp-admin-page.css', $this->_file ) );
1051
wp_enqueue_style( '404pagecss', plugins_url( 'assets/css/404page-ui.css', $this->_file ) );
1052
1053
}
1082
1083
}
1084
?>
1085
+ <div class="wrap pp-admin-page-wrapper" id="pp-404page-settings">
1086
<h1>
1087
<span><?php echo $this->plugin_name; ?></span>
1088
+ <nav>
1089
+ <?php $this->show_nav_icons( array(
1090
+ array(
1091
+ 'link' => 'https://wordpress.org/support/plugin/' . $this->plugin_slug . '/reviews/',
1092
+ 'title' => __( 'Please rate Plugin', '404page' ),
1093
+ 'icon' => 'dashicons-star-filled'
1094
+ ),
1095
+ array(
1096
+ 'link' => $this->wp_url,
1097
+ 'title' => __( 'WordPress.org Plugin Page', '404page' ),
1098
+ 'icon' => 'dashicons-wordpress'
1099
+ ),
1100
+ array(
1101
+ 'link' => $this->dc_url,
1102
+ 'title' => __( 'Plugin Doc', '404page' ),
1103
+ 'icon' => 'dashicons-book-alt'
1104
+ ),
1105
+ array(
1106
+ 'link' => 'https://wordpress.org/support/plugin/' . $this->plugin_slug,
1107
+ 'title' => __( 'Support', '404page' ),
1108
+ 'icon' => 'dashicons-editor-help'
1109
+ ),
1110
+ array(
1111
+ 'link' => 'https://petersplugins.com/',
1112
+ 'title' => __( 'Authors Website', '404page' ),
1113
+ 'icon' => 'dashicons-admin-home'
1114
+ ),
1115
+ array(
1116
+ 'link' => 'https://plus.google.com/+petersplugins',
1117
+ 'title' => __( 'Authors Google+ Page', '404page' ),
1118
+ 'icon' => 'dashicons-googleplus'
1119
+ ),
1120
+ array(
1121
+ 'link' => 'https://www.facebook.com/petersplugins/',
1122
+ 'title' => __( 'Authors Facebook Page', '404page' ),
1123
+ 'icon' => 'dashicons-facebook-alt'
1124
+ )
1125
+
1126
+ ) ); ?>
1127
+ </nav>
1128
</h1>
1129
<?php settings_errors(); ?>
1130
<form method="post" action="options.php">
1131
+ <h3><?php _e( 'General', '404page' ); ?></h3>
1132
<?php settings_fields( '404page_settings' ); ?>
1133
<?php do_settings_sections( '404page_settings_section' ); ?>
1134
+ <div id="pp-settings-advanced">
1135
+ <h3><?php _e( 'Advanced', '404page' ); ?></h3>
1136
<?php do_settings_sections( '404page_settings_section_advanced' ); ?>
1137
</div>
1138
<?php submit_button(); ?>
1142
}
1143
1144
1145
+ /**
1146
+ * show the nav icons
1147
+ * @since 6
1148
+ */
1149
+ function show_nav_icons( $icons ) {
1150
+
1151
+ foreach ( $icons as $icon ) {
1152
+
1153
+ echo '<a href="' . $icon['link'] . '" title="' . $icon['title'] . '"><span class="dashicons ' . $icon['icon'] . '"></span><span class="text">' . $icon['title'] . '</span></a>';
1154
+
1155
+ }
1156
+
1157
+ }
1158
+
1159
+
1160
/**
1161
* show admin notices
1162
*/
readme.txt CHANGED
@@ -1,10 +1,10 @@
1
=== 404page - your smart custom 404 error page ===
2
- Contributors: petersplugins
3
Donate link: https://petersplugins.com/make-a-donation/
4
Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page
5
Requires at least: 3.0
6
Tested up to: 4.9
7
- Stable tag: 5
8
Requires PHP: 5.4
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
@@ -13,7 +13,7 @@ Custom 404 the easy way! Set any page as custom 404 error page. No coding needed
13
14
== Description ==
15
16
- <strong>The [404page](https://petersplugins.com/free-wordpress-plugins/404page/) plugin is the most used plugin to create a customized 404 error page in WordPress.</strong>
17
18
It allows you to easily create your own 404 error page without any effort and it works with almost every theme.
19
@@ -29,21 +29,31 @@ Different from other similar plugins the 404page plugin **does not create redire
29
30
Different from other similar plugins the 404page plugin **does not create additional server requests**.
31
32
- == Docs & Support ==
33
34
- Video: [A brief Introduction to the free WordPress Plugin 404page](https://youtu.be/HygoFMwdIuY)
35
36
- Video: [A quick Overview over the Advanced Settings](https://youtu.be/9rL9LbYiSJk=)
37
38
[Plugin Manual](http://petersplugins.com/docs/404page/)
39
40
[Support Forum](https://wordpress.org/support/plugin/404page)
41
42
- == GDPR Info ==
43
44
- This plugin is fully GDPR compliant. It does not set cookies. It does not collect or store any data. It does not send any data to external servers.
45
46
- [Peters' Plugins GDPR Compliance Information Page](https://petersplugins.com/gdpr-compliance-information/)
47
48
== Compatibility ==
49
@@ -70,6 +80,7 @@ This plugin is fully GDPR compliant. It does not set cookies. It does not collec
70
* [Vantage](https://wordpress.org/themes/vantage/)
71
* [Virtue](https://wordpress.org/themes/virtue/)
72
* [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
73
**Note**: The [Enfold](https://themeforest.net/item/enfold-responsive-multipurpose-theme/4519990?ref=petersplugins) Theme is no longer supported because the Theme now has its own custom 404 error page feature.
74
75
= The 404page plugin was sucessfully tested by the author with the following starter themes =
@@ -86,7 +97,7 @@ This plugin is fully GDPR compliant. It does not set cookies. It does not collec
86
* [Polylang](https://wordpress.org/plugins/polylang/)
87
* [User Submitted Posts](https://wordpress.org/plugins/user-submitted-posts/)
88
* [WooCommerce](https://wordpress.org/plugins/woocommerce/)
89
- * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/)(Read more about [WP Super Cache Compatibility](http://petersplugins.com/docs/404page/#wp_super_cache))
90
* [WPML WordPress Multilingual Plugin](https://wpml.org/) ([officially approved by WPML team](https://wpml.org/plugin/404page/))
91
92
== For developers ==
@@ -108,16 +119,20 @@ If you are a theme developer you can add native support for the 404page plugin t
108
109
[Follow me on Google+](https://plus.google.com/+petersplugins)
110
[Follow me on Facebook](https://www.facebook.com/petersplugins/)
111
112
== Screenshots ==
113
114
- 1. How to easily create your custom 404 error page
115
116
== Frequently Asked Questions ==
117
118
- = Are there any requirements? =
119
120
- To enable the WordPress 404 error handling you have to set the Permalink Structure ('Settings' -> 'Permalinks') to anything else but 'Default'. Otherwise 404 errors are handled by the webserver and not by WordPress.
121
122
= Are 404 errors redirected? =
123
@@ -127,8 +142,15 @@ No, there is no redirection! The chosen page is delivered as a 'real' 404 error
127
128
The 404page plugin adds a CSS class `error404` to the `<body>` tag which can be used for extra styling.
129
130
== Changelog ==
131
132
= 5 (2018-03-05) =
133
* show an indicator if the currently edited page is a 404 error page
134
* minor code- & UI-improvements
@@ -224,6 +246,9 @@ The 404page plugin adds a CSS class `error404` to the `<body>` tag which can be
224
225
== Upgrade Notice ==
226
227
= 5 =
228
show an indicator if the currently edited page is a 404 error page
229
1
=== 404page - your smart custom 404 error page ===
2
+ Contributors: petersplugins
3
Donate link: https://petersplugins.com/make-a-donation/
4
Tags: page, 404, error, error page, 404 page, page not found, page not found error, 404 error page, missing, broken link, template, 404 link, seo, custom 404, custom 404 page, custom 404 error, custom 404 error page, customize 404, customize 404 page, customize 404 error page
5
Requires at least: 3.0
6
Tested up to: 4.9
7
+ Stable tag: 6
8
Requires PHP: 5.4
9
License: GPLv2 or later
10
License URI: http://www.gnu.org/licenses/gpl-2.0.html
13
14
== Description ==
15
16
+ <strong>With 70,000+ active installations the [404page](https://petersplugins.com/free-wordpress-plugins/404page/) plugin is the most used plugin to create a customized 404 error page in WordPress.</strong>
17
18
It allows you to easily create your own 404 error page without any effort and it works with almost every theme.
19
29
30
Different from other similar plugins the 404page plugin **does not create additional server requests**.
31
32
+ == Requirements ==
33
34
+ The only requirement for this plugin is that you change the Permalink Structure in ‘Settings’ -> ‘Permalinks’ to anything else but ‘Plain’. This also activates the WordPress 404 error handling.
35
36
+ == Docs & Support ==
37
38
[Plugin Manual](http://petersplugins.com/docs/404page/)
39
40
[Support Forum](https://wordpress.org/support/plugin/404page)
41
42
+ == Videos ==
43
+
44
+ [A brief Introduction to the free WordPress Plugin 404page](https://youtu.be/HygoFMwdIuY)
45
+
46
+ [A quick Overview over the Advanced Settings](https://youtu.be/9rL9LbYiSJk=)
47
+
48
+ [The Advanced Setting "Force 404 error after loading page" explained](https://youtu.be/09OOCbFLfnI)
49
50
+ == Plugin Privacy Information ==
51
52
+ * This plugin does not set cookies
53
+ * This plugin does not collect or store any data
54
+ * This plugin does not send any data to external servers
55
+
56
+ [Peters' Plugins Privacy Information Page](https://petersplugins.com/plugin-privacy-information/)
57
58
== Compatibility ==
59
80
* [Vantage](https://wordpress.org/themes/vantage/)
81
* [Virtue](https://wordpress.org/themes/virtue/)
82
* [Zerif Lite](http://themeisle.com/themes/zerif-lite/)
83
+
84
**Note**: The [Enfold](https://themeforest.net/item/enfold-responsive-multipurpose-theme/4519990?ref=petersplugins) Theme is no longer supported because the Theme now has its own custom 404 error page feature.
85
86
= The 404page plugin was sucessfully tested by the author with the following starter themes =
97
* [Polylang](https://wordpress.org/plugins/polylang/)
98
* [User Submitted Posts](https://wordpress.org/plugins/user-submitted-posts/)
99
* [WooCommerce](https://wordpress.org/plugins/woocommerce/)
100
+ * [WP Super Cache](https://wordpress.org/plugins/wp-super-cache/) (Read more about [WP Super Cache Compatibility](http://petersplugins.com/docs/404page/#wp_super_cache))
101
* [WPML WordPress Multilingual Plugin](https://wpml.org/) ([officially approved by WPML team](https://wpml.org/plugin/404page/))
102
103
== For developers ==
119
120
[Follow me on Google+](https://plus.google.com/+petersplugins)
121
[Follow me on Facebook](https://www.facebook.com/petersplugins/)
122
+ [YouTube Channel](https://www.youtube.com/channel/UCDnOjy99A7Oeq2dTWxqWEIA)
123
124
== Screenshots ==
125
126
+ 1. The default 404 error page of the currently used themme (WP Bootstrap Starter used for this example)
127
+ 2. Create custom 404 error page like any other page using the WordPress editor
128
+ 3. Select the created page as 404 error page
129
+ 4. The custom 404 error page in action
130
131
== Frequently Asked Questions ==
132
133
+ = Will it work with the theme I'm using? =
134
135
+ This plugin is designed to work with as many themes as possible. It uses the WordPress Template System to detect and handle 404 errors. If your theme makes use of this Template System this plugin will work properly. If it does not the plugin offers a so called Compatibility Mode, which uses its completely own method to detect and handle 404 errors. If this plugin does not work properly, try to activate Compatibility Mode.
136
137
= Are 404 errors redirected? =
138
142
143
The 404page plugin adds a CSS class `error404` to the `<body>` tag which can be used for extra styling.
144
145
+ = Where can I get help? =
146
+ Please use the [Support Forum](https://wordpress.org/support/plugin/404page).
147
+
148
== Changelog ==
149
150
+ = 6 (2018-06-18) =
151
+ * exclude 404 page from XML sitemap generated by Yoast SEO
152
+ * further UI-improvements
153
+
154
= 5 (2018-03-05) =
155
* show an indicator if the currently edited page is a 404 error page
156
* minor code- & UI-improvements
246
247
== Upgrade Notice ==
248
249
+ = 6 =
250
+ exclude 404 page from XML sitemap generated by Yoast SEO
251
+
252
= 5 =
253
show an indicator if the currently edited page is a 404 error page
254