Skip to content

Commit

Permalink
Adds widget area to 404 template
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-bernhardt committed Sep 4, 2019
1 parent 74110c2 commit aeb4708
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 4 deletions.
18 changes: 14 additions & 4 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,21 @@
<div class="main-content content-main">

<article id="post-0" class="post error404 no-results not-found">
<header class="entry-header">
<h1 class="entry-title">This file was not found.</h1>
</header>

<?php get_template_part( 'inc/site-search' ); ?>
<?php if ( is_active_sidebar( 'sidebar-404' ) ) { ?>

<div id="sidebar-404" class="widget-area" role="complementary">
<?php dynamic_sidebar( 'sidebar-404' ); ?>
</div>

<?php } else { ?>

<header class="entry-header">
<h1 class="entry-title">The requested content was not found.</h1>
</header>
<?php get_template_part( 'inc/site-search' ); ?>

<?php } ?>

</article><!-- #post-0 -->

Expand Down
11 changes: 11 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,17 @@ function mitlib_widgets_init() {
'after_title' => '</h3>',
'class' => '',
) );

register_sidebar( array(
'name' => __( 'Migrated Content Notice', 'twentytwelve' ),
'id' => 'sidebar-404',
'description' => __( 'Appears on the 404 page, allowing individual sites to post notices about migrated content', 'twentytwelve' ),
'before_widget' => '<aside id="%1$s" class="widget %2$s" role="complementary">',
'after_widget' => '</aside>',
'before_title' => '<h2 class="widget-title">',
'after_title' => '</h2>',
) );

}
add_action( 'widgets_init', 'mitlib_widgets_init' );

Expand Down

0 comments on commit aeb4708

Please sign in to comment.