storefront/404.php
Fränk Klein 759fc7e7c9 Fixes escaping in the 404.php template.
- Static strings (as in `echo 'hey';`) or numbers do not need to be
escaped, as there is no possibility to change them without changing the
code.
- When escaping numbers passed to query functions, `absint()` should be
used instead of `intval()`, to make sure to obtain positive integers.
- Strings that are output in HTML should be escaped with `esc_html()`
instead of `esc_attr()`.
- `esc_attr( __() )` can be written as `esc_attr__()`, same for
`esc_html( __() )`.
- Translations should always be escaped.
2015-07-16 18:25:17 +02:00

74 lines
1.8 KiB
PHP

<?php
/**
* The template for displaying 404 pages (not found).
*
* @package storefront
*/
get_header(); ?>
<div id="primary" class="content-area">
<main id="main" class="site-main" role="main">
<section class="error-404 not-found">
<div class="page-content">
<header class="page-header">
<h1 class="page-title"><?php esc_html_e( 'Oops! That page can&rsquo;t be found.', 'storefront' ); ?></h1>
</header><!-- .page-header -->
<p><?php esc_html_e( 'Nothing was found at this location. Try searching, or check out the links below.', 'storefront' ); ?></p>
<?php
if ( is_woocommerce_activated() ) {
the_widget( 'WC_Widget_Product_Search' );
} else {
get_search_form();
}
?>
<?php
if ( is_woocommerce_activated() ) {
echo '<div class="fourohfour-columns-2">';
echo '<div class="col-1">';
echo '<h2>' . esc_html__( 'Featured Products', 'storefront' ) . '</h2>';
echo storefront_do_shortcode( 'featured_products', array(
'per_page' => 2,
'columns' => 2,
) );
echo '</div>';
echo '<div class="col-2">';
echo '<h2>' . esc_html__( 'Product Categories', 'storefront' ) . '</h2>';
the_widget( 'WC_Widget_Product_Categories', array(
'count' => 1,
) );
echo '</div>';
echo '</div>';
echo '<h2>' . esc_html__( 'Popular Products', 'storefront' ) . '</h2>';
echo storefront_do_shortcode( 'best_selling_products', array(
'per_page' => 4,
'columns' => 4,
) );
}
?>
</div><!-- .page-content -->
</section><!-- .error-404 -->
</main><!-- #main -->
</div><!-- #primary -->
<?php get_footer(); ?>