Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adds widget area to 404 template #287

Merged
merged 3 commits into from
Sep 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
27 changes: 20 additions & 7 deletions css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Theme Name: MIT Libraries
Author: Lightning Trumpet
Author URI: http://wordpress.org/
Version: 1.7.0-@@branch-@@commit
Version: 1.8.0-@@branch-@@commit
MIT Libraries theme built for the MIT Libraries website.
*/

Expand Down Expand Up @@ -1265,26 +1265,39 @@ a.comment-edit-link:hover {
/* Search Form / 404 page
-------------------------------------------------------------- */

.error404 .entry-header {
article.error404 .entry-header,
article.error404 h2.widget-title {
margin: 3rem 0;
border-bottom: 1px solid #ccc;
padding-bottom: 2rem;
}

.error404 .entry-content h2 {
font-size: 18px;
article.error404 h2.widget-title,
article.error404 h1.entry-title {
font-size: 25px;
font-weight: normal;
margin-top: 1em;
}

.error404 .entry-content form {
margin-bottom: 2r em;
article.error404 .entry-content form {
margin-bottom: 2rem;
}

.error404 p {
article.error404 p {
margin: 1em 0;
}

article.error404 ul {
margin-bottom: 10px;
}

article.error404 ul li {
list-style: disc;
margin-left: 40px;
margin-bottom: 5px;
line-height: 23px;
}

/* =Media queries
-------------------------------------------------------------- */

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
2 changes: 1 addition & 1 deletion style.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Theme Name: MIT Libraries
Author: Lightning Trumpet
Author URI: http://wordpress.org/
Version: 1.7.0-@@branch-@@commit
Version: 1.8.0-@@branch-@@commit

MIT Libraries theme built for the MIT Libraries website.

Expand Down