Skip to content
This repository has been archived by the owner. It is now read-only.

403 Forbidden Page #136

Merged
merged 8 commits into from
Jan 29, 2016
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
53 changes: 53 additions & 0 deletions 403.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
<?php
/**
* The template for displaying 403 pages (Forbidden).
*
* @package cornerstone
*/
get_header(); ?>
<div id="error403">
<div class="row">
<div class="col-sm-12">
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<section class="error-403 not-found">
<div class="row">
<div class="col-sm-6">
<header class="page-header">
<h1 class="page-title"><?php _e( 'I\'m Sorry... <br/>That page can&rsquo;t be found.', 'cs' ); ?></h1>
<p class="text-muted">Error 403: Forbidden.</p>
</header><!-- .page-header -->
<div class="page-content">
<p><?php _e( 'It looks like nothing was found at this location. Maybe try one of the links above or a search?', 'cs' ); ?></p>
<div class="col-sm-6">
<?php get_search_form(); ?>
</div>
<div class="col-sm-6">
<ul>
<?php
if (wp_get_nav_menu_object('404')){
$defaults = array(
'menu' => '404',
'container' => false,
'items_wrap' => '%3$s',
'depth' => 1,
'fallback_cb' => false
);
wp_nav_menu( $defaults );
}
?>
</ul>
</div>
</div><!-- .page-content -->
</div>
<div class="col-sm-6">
<img src="<?php bloginfo('template_directory'); ?>/img/JonathanStill.jpg" alt="Photo of a puppy."/>
</div>
</div>
</section><!-- .error-404 -->
</main><!-- #main -->
</div><!-- #primary -->
</div>
</div>
</div>
<?php get_footer(); ?>
7 changes: 0 additions & 7 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,6 @@
* @package cornerstone
*/
get_header(); ?>
<?php
$private = get_post_meta(get_queried_object()->ID, 'uc-private', true);
if($private == 'admins' || $private == 'users' || $private == 'list' || $private == 'netids'){
$private = true;
echo 'This is a private page';
}
?>
<div id="error404">
<div class="row">
<div class="col-sm-12">
Expand Down
33 changes: 25 additions & 8 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,24 +115,24 @@ function cs_widgets_init() {
*/
require get_template_directory() . '/inc/customizer.php';

/**
/**
* New nav walkers
*/
require get_template_directory() . '/inc/nav-walker.php';
require get_template_directory() . '/inc/nav-drop-multi-walker.php';
require get_template_directory() . '/inc/nav-tabs-walker.php';

/**
/**
* Bootstrap the comment form.
*/
require get_template_directory() . '/inc/bootstrap-forms.php';

/**
/**
* Custom site settings
*/
require get_template_directory() . '/inc/settings.php';

/**
/**
* Bootstrap Whitelist
*/
require get_template_directory() . '/inc/bootstrap-whitelist.php';
Expand Down Expand Up @@ -175,13 +175,13 @@ function hale_main_nav_fallback($args) {
} else {
echo '<div'.$attributes.'>';
}

}
$attributes = (!empty($args['menu_class'])?' class="'.$args['menu_class'].'"':'');
$attributes .= (!empty($args['menu_id'])?' id="'.$args['menu_id'].'"':'');
echo '<ul'.$attributes.'>';
if($data->length > 0) {
foreach($data as $item) {
foreach($data as $item) {
echo $item->ownerDocument->saveXML($item);//saveHTML wouldn't accept it as paramater.
}
}
Expand All @@ -193,9 +193,9 @@ function hale_main_nav_fallback($args) {
} else {
echo '</div>';
}

}
}
}
return;
}

Expand Down Expand Up @@ -247,4 +247,21 @@ function ssi_add_widget_class( $classes ) {
return $classes;
}

function uc_redirect_403() {
if( get_query_var( 'is_403' ) == true ){
global $wp_query;

status_header(403);
$wp_query->is_404=false;

add_filter( 'wp_title', function( $title='', $sep='' ){
return "Forbidden | ".get_bloginfo('name');
});
get_template_part('403');
exit;
}
}

add_action( 'template_redirect', 'uc_redirect_403' );

?>
Loading