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

404 page improvements #1168

Merged
merged 4 commits into from
Mar 17, 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
29 changes: 29 additions & 0 deletions 404.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,35 @@

<div id="content" class="span8" role="main">
<?php get_template_part( 'partials/content', 'not-found' ); ?>
<p><?php
echo wp_kses(of_get_option('404_message'), array(
'a' => array(),
'b' => array(),
'br' => array(),
'i' => array(),
'em' => array(),
'strong' => array(),
));
?></p>

<?php
/*
* Display the Recent Posts widget
*
* @since 0.5.5
* @link http://jira.inn.org/browse/WE-103
* @link https://codex.wordpress.org/Function_Reference/the_widget
*/
if ( class_exists( 'largo_recent_posts_widget' ) ) {
the_widget(
'largo_recent_posts_widget',
array (
),
array(
)
);
}
?>
</div><!--#content -->

<?php get_sidebar(); ?>
Expand Down
6 changes: 6 additions & 0 deletions options.php
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,12 @@ function optionsframework_options() {
'std' => '0',
'type' => 'checkbox');

$options[] = array(
'desc' => __('<strong>404 page text.</strong> This will be displayed on the 404 page, which is shown when people try to navigate to a page on your site that does not exist. Allowed HTML tags are <code>a</code>, <code>b</code>, <code>br</code>, <code>em</code>, <code>i</code> and <code>strong</code>.', 'largo'),
'id' => '404_message',
'std' => '',
'type' => 'textarea');

$options[] = array(
'name' => __('Byline Options', 'largo'),
'type' => 'info');
Expand Down
17 changes: 15 additions & 2 deletions partials/content-not-found.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,23 @@
<?php
$apologies = __('Apologies, but no results were found. Perhaps searching will help.', 'largo');

if ( is_404() ) {
$apologies = sprintf(
__("Apologies, but <code>%s</code> was not found. Perhaps searching will help.", 'largo'),
wp_kses($_SERVER['REQUEST_URI'], array()) // The url, sanitized
);
} else if ( is_search() ) {
$apologies = __("Apologies, but no results were found. Perhaps searching for something else will help.", 'largo');
}

?>
<article id="post-0" class="post no-results not-found">
<header class="entry-header">
<h1 class="entry-title"><?php _e('Nothing Found', 'largo'); ?></h1>
</header><!-- .entry-header -->

<div class="entry-content">
<p><?php _e('Apologies, but no results were found. Perhaps searching will help.', 'largo'); ?></p>
<p><?php echo $apologies; ?></p>
<?php get_search_form(); ?>
</div><!-- .entry-content -->
</article><!-- #post-0 -->
</article><!-- #post-0 -->
2 changes: 1 addition & 1 deletion searchform.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
?>
<form class="form-search" role="search" method="get" action="<?php echo esc_url( home_url( '/' ) ); ?>">
<div>
<input type="text" placeholder="<?php _e('Search', 'largo'); ?>" class="searchbox search-query" value="" name="s" />
<input type="text" placeholder="<?php _e('Search', 'largo'); ?>" class="searchbox search-query" value="<?php the_search_query(); ?>" name="s" />
<input type="submit" value="<?php _e('Go', 'largo'); ?>" name="search submit" class="search-submit btn">
</div>
</form>