Plugin / Genesis Widgetized Not Found & 404 – Easy Setup for 404 Page and Search Not Found

David Decker - DECKERWEB

Frequently Asked Questions (FAQ)

For the 404 error (“Page not found”) the proper 404 HTTP status code gets delivered. This is completely done via Genesis itself, NOT by this plugin. This plugin “only” tweaks the content that is rendered on the 404 page in the browser. Everything else is done by Genesis. This is also how it should be. You can (bulk) check the status yourself for any URL on online services like these: https://httpstatus.io/ https://techseo.de/statuscodes/
You can use my “Genesis Layout Extras” plugin for that, which has an option for the 404 case built in. Or you can also use my built in helper function and add this little line to your functions.php of your child theme (backup file before!) or to the “Custom Function” section of Prose Child Theme 1.5+: /** Genesis Widgetized NotFound: 404 Error Page - Full-Width Layout */ add_action( 'genesis_meta', '__gwnf_layout_404_full_width' );
You can use my “Genesis Layout Extras” plugin for that, which has an option for the search case built in. — Or you can also use my built in helper function and add this little line to your functions.php of your child theme (backup file before!) or to the “Custom Functions” section of Prose Child Theme 1.5+: /** Genesis Widgetized NotFound: Search not found Page - Full-Width Layout */ add_action( 'genesis_meta', '__gwnf_layout_searchnotfound_full_width' ); Note: The above code is restricted to the case when NO search results are found! It doesn’t effect your search results display IF THERE ARE any results!
It’s all done via your child theme. Maybe you need to add an “!important” to some CSS rules here and there… For more even better styling I included some IDs and classes: “404 Error Page” section: the whole content area, before and after all widgets is wrapped in a div with the ID: #gwnf-404-area each widget in this area has its own ID depending on the widget (regular WordPress behavior!) each widget gets an additional class: .gwnf-404 — which allows to set some common styles for all widgets in this area “Search not found” section: the whole content area, before and after all widgets is wrapped in a div with the ID: #gwnf-notfound-area each widget in this area has its own ID depending on the widget (regular WordPress behavior!) each widget gets an additional class: .gwnf-notfound — which allows to set some common styles for all widgets in this area Note, WordPress itself additionally adds body classes in the 404 case and the search not found case. So you can also use these classes: .error404 and .search-no-results If that’s still not enough, you can even enqueue your own style, an action hook is included for that: gwnf_load_styles — This hook fires within the WordPress action hook wp_enqueue_scripts just after properly enqueueing the plugin’s styles and only if at least one of both widgets is active, so it’s fully conditional!
Of course, it’s possible! Just add the following constant to your child theme’s functions.php file or to a functionality plugin: /** Genesis Widgetized Not Found & 404: Remove Widgets Shortcode Support */ define( 'GWNF_NO_WIDGETS_SHORTCODE', TRUE ); Some webmasters could need this for security reasons regarding their stuff members or for whatever other reasons… :).
(1) Parameters for [gwnf-widget-area] Shortcode: area — ID of the Widget area (Sidebar) (default: none, empty) The following values are accepted: 404 OR notfound OR bbpress-notfound (2) Parameters for [gwnf-search] Shortcode: search_text — Search placeholder text (default: Search this website) button_text — HTML wrapper tag (default: Search) form_label — Additional label before the search form (default: none, empty) wrapper — HTML wrapper tag (default: Latest update date:) class — Additional custom CSS class for the wrapper (default: none, empty) post_type — Optional setup post type(s) for search (default: none, empty – i.e., WordPress default search behavior!)
Of course, that’s possible! Just add the following constant to your child theme’s functions.php file or to a functionality plugin: /** Genesis Widgetized Not Found & 404: Remove Shortcode Features */ define( 'GWNF_SHORTCODE_FEATURES', TRUE );
Of course, that’s possible – very easily :). Just add the following line of code to your child theme’s functions.php file or a functionality plugin: /** * Genesis Widgetized Not Found & 404: * Remove bbPress Widgetized Content Area on "not found" */ add_filter( 'gwnf_filter_bbpress_noresults_widgetized', '__return_false' );
I’ve just included some filters for that – if ever needed (i.e. for clients, branding purposes etc.), you can use these filters: gwnf/filter/widget_areas/404/title – default value: “404 Error Page” gwnf/filter/widget_areas/404/description – default value: “This is the widget area of the 404 Not Found Error Page.” gwnf/filter/widget_areas/notfound/title – default value: “Search Not Found” gwnf/filter/widget_areas/notfound/description – default value: “This is the widget area of the search not found content section.” gwnf_filter_notfound_default – default value: “Sorry, no content matched your criteria. Try a different search?” Example code for changing one of these filters: add_filter( 'gwnf/filter/widget_areas/404/title', 'custom_404_widget_title' ); /** * Genesis Widgetized NotFound: Custom 404 Widget Title */ function custom_404_widget_title() { return __( 'Custom Error Page', 'your-child-theme-textdomain' ); } Final note: I DON’T recommend to add customization code snippets to your child theme’s functions.php file! Please use a functionality plugin instead! In general you should not abusing the functions.php for plugin-specific stuff. And you are then also more independent from child theme changes etc. If you don’t know how to create such a plugin yourself just use one of my recommended ‘Code Snippets’ plugins. Read & bookmark these Sites: Code Snippets plugin by Shea Bunge PHP Code Snippets (Insert PHP) plugin by webcraftic “What is a functionality plugin and how to create one?” – blog post by WPCandy “Creating a custom functions plugin for end users” – blog post by Justin Tadlock All the custom & branding stuff code above can also be found as a Gist on GitHub: https://gist.github.com/deckerweb/2473125 (you can also add your questions/ feedback there 🙂
(1) In general: You may use it for “global” widgets. (2) Usage with the “WPML” plugin: Widgets can be translated with their “String Translation” component – this is much easier than adding complex information/instructions to the 404 error or search not found pages for a lot of languages… You can use the awesome “Widget Options” or “Widget Logic” plugins (or similar ones) and add additional paramaters, mostly conditional stuff like is_home() in conjunction with is_language( 'de' ) etc. This way widget usage on a per-language basis is possible. Or you place in the WPML language codes like ICL_LANGUAGE_CODE == 'de' for German language. Fore more info on that see their blog post: http://wpml.org/2011/03/howto-display-different-widgets-per-language/ With the following language detection code you are now able to make conditional statements, in the same way other WordPress conditional functions work, like is_single(), is_home() etc.: if ( ! function_exists( 'is_language' ) ) : /** * WPML: Conditional Switching Languages * * @author David Decker - DECKERWEB * @link https://twitter.com/deckerweb * * @global mixed $GLOBALS[ 'sitepress' ] */ function is_language( $current_lang ) { if ( $current_lang == $GLOBALS[ 'sitepress' ]->get_current_language() ) { return TRUE; } } // end function endif; Note: Be careful with the function name ‘is_language’ – this only works if there’s no other function in your install with that name! If it’s already taken (very rare case though), then just add a prefix like my_custom_is_language(). –> You now can use conditionals like that: if ( is_language( 'de' ) ) { // do something for German language... } elseif ( is_language( 'es' ) ) { // do something for Spanish language... }
English – default, always included German (de_DE): Deutsch – immer dabei! 🙂 For custom and update-safe language files please upload them to /wp-content/languages/genesis-widgetized-notfound/ (just create this folder) – This enables you to use fully custom translations that won’t be overridden on plugin updates. Also, complete custom English wording is possible with that as well, just use a language file like genesis-widgetized-notfound-en_US.mo/.po to achieve that (for creating one see the following tools). Easy WordPress.org plugin translation platform with GlotPress platform: Translate “Genesis Widgetized Not Found & 404″… Note: All my plugins are internationalized/ translateable by default. This is very important for all users worldwide. So please contribute your language to the plugin to make it even more useful. For translating and validating I recommend the awesome “Poedit Editor”, which works fine on Windows, macOS and Linux.

Ratings

5
9 reviews

Rating breakdown

Details Information

Version

1.6.4

First Released

20 Apr, 2012

Total Downloads

25,518

Wordpress Version

3.6 or higher

Tested up to:

5.3

Require PHP Version:

5.6 or higher

Tags

Contributors

Languages

DIRECTORY DISCLAIMER

The information provided in this THEME/PLUGIN DIRECTORY is made available for information purposes only, and intended to serve as a resource to enable visitors to select a relevant theme or plugin. wpSocket gives no warranty of any kind, express or implied with regard to the information, including without limitation any warranty that the particular theme or plugin that you select is qualified on your situation.

The information in the individual theme or plugin displayed in the Directory is provided by the owners and contributors themselves. wpSocket gives no warranty as to the accuracy of the information and will not be liable to you for any loss or damage suffered by you as a consequence of your reliance on the information.

Links to respective sites are offered to assist in accessing additional information. The links may be outdated or broken. Connect to outside sites at your own risk. The Theme/Plugin Directory does not endorse the content or accuracy of any listing or external website.

While information is made available, no guarantee is given that the details provided are correct, complete or up-to-date.

wpSocket is not related to the theme or plugin, and also not responsible and expressly disclaims all liability for, damages of any kind, arising out of the use, reference to, or reliance on, any information or business listed throughout our site.

Keep Leading Your Followers!
Share it for them.