New Flexibility plus Enhanced User Experience
We all know that sometimes 404 Errors happen on our sites. And sometimes users search but get no results. I believe it's better to serve users some highly customized and maintained pages/content areas for these cases. What better to do that with Widgets in WordPress? -- In my opinion Genesis Framework could improve here so that's why I just made this little plugin to FINALLY have these two cases maintainable EASILY via your widgets admin. Just place in a search widget, your last blog posts, an image widget, some explanation via text widget, some galleries... You got it. The possibilities are endless. Finally.
A great helper tool for Genesis Child Themes!
Advantages
- Helps users stay longer on your site because you can give options like search form, recent posts etc.
- Hugely improved user experience! (Helps decrease the "Oops, I broke the internet..." experiences...)
- Easily customizeable for any webmaster!
- Works across Genesis child themes - so you can switch your "skin" but not loosing this tool :-)
- Ideal for multilingual websites (for example with "WPML"): Much better handling of 404/Not found content for different languages. -- See bottom of FAQ section here for more info on that.
General Features
- Small & lightweight plugin tool: Just activate plugin, place your widgets and you're done!
- Adds a new widget area (Sidebar) for the "404 Error Page"
- Adds a new widget area (Sidebar) for the "Search not found" page (if there no results on search)
- Adds a few CSS styles for the content area to properly divide widgets with some more space (all other styling is recommended via your child theme)
- Included are two handy helper functions (via child theme) for applying the Genesis 'Full-Width' layout option for one or both 'not found' cases! -- See the FAQ section for more info on that!
- Customizeable via 5 filters: if ever needed you can customize the widget titles and descriptions and for edge case even the "search not found" default text (if you forgot to use a widget here...)
- Fully internationalized! Real-life tested and developed with international users in mind!
- Fully WPML compatible!
- Fully Multisite compatible, you can also network-enable it if ever needed (per site use is recommended).
- Tested with WordPress versions 3.4 branch (plus former 3.3 branch) - also in debug mode (no stuff there, ok? :)
Please note: Genesis Widgetized Not Found & 404 requires the Genesis Theme Framework.
Localization
- English (default) - always included
- German (de_DE) - always included
- .pot file (
genesis-widgetized-notfound.pot) for translators is also always included :) - Easy plugin translation platform with GlotPress tool: Translate "Genesis Widgetized Not Found & 404"...
- Your translation? - Just send it in
A plugin from deckerweb.de and GenesisThemes
Feedback
- I am open for your suggestions and feedback - Thank you for using or trying out one of my plugins!
- Drop me a line @deckerweb on Twitter
- Follow me on my Facebook page
- Or follow me on +David Decker on Google Plus ;-)
More
- Also see my other plugins or see my WordPress.org profile page
- Tip: GenesisFinder - Find then create. Your Genesis Framework Search Engine.
- Hey, come & join the Genesis Community on Google+ :)
Download
Latest version: Download Genesis Widgetized Not Found & 404 v1.4.0 (Downloaded: 4,611 times)
Installation
- Upload
genesis-widgetized-notfoundfolder to the/wp-content/plugins/directory -- or just upload the ZIP package via 'Plugins > Add New > Upload' in your WP Admin - Activate the plugin through the 'Plugins' menu in WordPress
- Got the "Widgets" admin page and configure your widgets for the "404 Error Page" and the "Search Not Found" page.
- Hope the new widgets will never be needed, but in case, you're prepared now! :-)
Note: The Genesis Framework is required for this plugin in order to work.
Own translation/wording: For custom and update-secure 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, just use a language file like genesis-widgetized-notfound-en_US.mo/.po to achieve that (for creating one see the tools on "Other Notes").
Screenshots
-
Genesis Widgetized NotFound & 404: two additional widget areas/sidebars - here with some example widgets placed in... (Click here for larger version of screenshot)
-
Genesis Widgetized NotFound & 404: the plugin in action on a live site - displaying here the "Search not found" case - three widgets placed in (Text widget, Search Form widget, recent Posts widget). (Click here for larger version of screenshot)
FAQ
How can I change the layout of the '404 Error Page' (i.e. go full-width)?
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' );
How can I change the layout of the 'Search not found' Page (i.e. go 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!
How can I style the content/widget areas?
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
- the whole content area, before and after all widgets is wrapped in a div with the ID:
- "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
- the whole content area, before and after all widgets is wrapped in a div with the ID:
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!
How can I customize the widget titles/strings in the admin?
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_404_widget_title - default value: "404 Error Page"
gwnf_filter_404_widget_description - default value: "This is the widget area of the 404 Not Found Error Page."
gwnf_filter_notfound_widget_title - default value: "Search Not Found"
gwnf_filter_notfound_widget_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_404_widget_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 or an MU-plugin instead! This way you can also use this better for Multisite environments. In general you are 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:
- "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
- DON'T hack your
functions.phpfile: Resource One - Resource Two (both by Thomas Griffin Media) - "Code Snippets" plugin by Shea Bunge - also network wide!
- "Code With WP Code Snippets" plugin by Thomas Griffin - Note: Plugin currently in development at GitHub.
- "Toolbox Modules" plugin by Sergej Müller - see also his plugin instructions.
All the custom & branding stuff code above can also be found as a Gist on GitHub: https://gist.github.com/2473125 (you can also add your questions/ feedback there :)
How can I use the advantages of this plugin for multlingual sites?
(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 Logic" plugin (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.:
/**
* WPML: Conditional Switching Languages
*
* @author David Decker - DECKERWEB
* @link http://twitter.com/deckerweb
*
* @global mixed $sitepress
*/
function is_language( $current_lang ) {
global $sitepress;
if ( $current_lang == $sitepress->get_current_language() ) {
return true;
}
}
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...
}Changelog
1.4.0 (2012-12-15)
- Maintenance release
- UPDATE: Added the class placeholder to widget registrations to fullfill WordPress standard for Widgets API.
- NEW: Added constant for disabling the widget shortcode support (see FAQ here).
- CODE: Some code/documentation updates & improvements.
- UPDATE: Updated readme.txt file here.
- UPDATE: Initiated new three digits versioning, starting with this version.
- UPDATE: Updated German translations and also the .pot file for all translators.
- UPDATE: Moved screenshots to 'assets' folder in WP.org SVN to reduce plugin package size.
1.3.0 (2012-08-20)
- Maintenance release
- NEW: Added help tab also on Genesis settings page.
- NEW: Compressed CSS file for improved performance (the development file has now the file name
gwnf-styles.dev.cssand is still packaged). - CODE: Minor code/documentation updates & improvements.
- UPDATE: Updated German translations and also the .pot file for all translators.
- UPDATE: Extended GPL License info in readme.txt as well as main plugin file.
- NEW: Easy plugin translation platform with GlotPress tool: Translate "Genesis Widgetized Not Found & 404"...
1.2.0 (2012-04-27)
- NEW: Added little help tab on Widget admin page for better user experience. (Works only with WordPress 3.3 or higher!)
- UPDATE: Moved plugin links from main file to extra admin file which only loads within 'wp-admin', this way it's performance-improved! This also effects the new help tab stuff :).
- UPDAGE: Added action hook
gwnf_load_stylesif you ever need to properly enqueue your own stylesheet for the edge cases... (Also see FAQ here). - CODE: Minor code/documentation tweaks and improvements.
- UPDATE: Extended and improved readme.txt file documentation here, corrected typos.
- UPDATE: Updated German translations and also the .pot file for all translators.
1.1.0 (2012-04-23)
- NEW: Added two helper functions (via child theme) for applying the Genesis 'Full-Width' layout option for one or both 'not found' cases! This is very handy for lots of use cases... -- See the FAQ section for more info on that!
- UPDATE: Placed widget display in conditionals only for the "404" or the "Search not found" case to avoid overlaying of more than one 'no content messages'. This should finally cover more edge cases...
- UPDATE: Improved translations loading, especially for activation (messages).
- UPDATE: Improved registering of widget areas/sidebars: switching back to Genesis register function, but now properly wrapped in a conditional, checking for activated Genesis. This way we also get further improved Multisite support!
- UPDATE: Improved CSS styling, handling the limition of the empty "p" (left over from the original "no content status" of Genesis).
- UPDATE: Updated German translations and also the .pot file for all translators.
1.0.1 (2012-04-20)
- Bugfix release. Mmh, stuff happens...
- UPDATE: Changed widget registering from Genesis to WordPress function (it doesn't matter in the end!)
- BUGFIX: Fixed function typo that was causing notices on plugin activation.
- UPDATE: Minor code documentation updates. Also, minor updates to readme.txt file here.
- UPDATE: Updated German translations and also the .pot file for all translators.
- UPDATE: Added banner image on WordPress.org for better plugin branding :)
1.0.0 (2012-04-20)
- Initial release











