Skip to content

Instantly share code, notes, and snippets.

@SeanTOSCD
Last active December 23, 2015 03:38
Show Gist options
  • Save SeanTOSCD/6574343 to your computer and use it in GitHub Desktop.
Save SeanTOSCD/6574343 to your computer and use it in GitHub Desktop.
Custom 404 template for Volatyl - CREATE a file in the ROOT of your Volatyl CHILD THEME and name it 404.php. Paste the code below into that file. This works for both Volatyl and Volatyl for EDD.
<?php
/** 404.php
*
* custom layout for 404 error pages -- place this file in the
* root of your child theme and WordPress will use it instead of the
* original 404 template. Edit this file as you wish!
*/
$options_structure = get_option('vol_structure_options');
// Custom filters
$error_404 = apply_filters('error_404_content', array(
'error_title' => 'Oops! Looks like we have an error.',
'error_content' => 'Use the search form and other tools below to find what you were looking for.'
));
get_header();
vol_html_before_content();
// HTML structure flexibility
if ($options_structure['wide'] == 1) :
echo "<div class=\"custom-404-area full clearfix\"><div class=\"main\">";
else :
echo "<div class=\"custom-404-area clearfix\">";
endif; ?>
<div class="custom-404 inner">
<article id="post-0" class="post error404 not-found">
<header class="entry-header">
<h1 class="entry-title">
<?php _e($error_404['error_title'], 'volatyl'); ?>
</h1>
</header>
<section class="entry-content">
<p>
<?php _e($error_404['error_content'], 'volatyl'); ?>
</p>
<?php
// output search form
get_search_form();
// output recent posts and categories widgets
the_widget('WP_Widget_Recent_Posts'); ?>
<div class="widget">
<h2 class="widgettitle">
<?php _e('Most Used Categories', 'volatyl'); ?>
</h2>
<ul>
<?php
wp_list_categories(array(
'orderby' => 'count',
'order' => 'DESC',
'title_li' => '',
'number' => 10,
'depth' => -1,
)); ?>
</ul>
</div>
<?php
// translators: %1$s: smilie
$archive_content = '<p>' . sprintf(__('Try looking in the monthly archives. %1$s', 'volatyl'), convert_smilies(':)')) . '</p>';
// output archives widget
the_widget('WP_Widget_Archives', 'dropdown=1', "after_title=</h2>$archive_content");
// output tag cloud widget
the_widget('WP_Widget_Tag_Cloud'); ?>
</section>
</article>
</div>
<?php
// HTML structure flexibility
echo (($options_structure['wide'] == 1) ? '</div>' : '');
echo "</div>";
vol_html_after_content();
get_footer();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment