Initial commit
This commit is contained in:
66
404.php
Normal file
66
404.php
Normal file
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
/**
|
||||
* Strona błędu 404
|
||||
*
|
||||
* @link https://krzysztof-turek.com
|
||||
*
|
||||
* @package tylkofotografia.pl
|
||||
* @version 0.1
|
||||
*/
|
||||
get_header();
|
||||
global $post;
|
||||
global $wpdb;
|
||||
|
||||
$upload_dir = wp_upload_dir();
|
||||
|
||||
$most = $wpdb->get_row(
|
||||
"SELECT sum(count) views, id FROM `wp_statistics_pages` where id not in ( 0,1,3)
|
||||
group BY `wp_statistics_pages`.`id` order by views desc limit 1"
|
||||
);
|
||||
$postMostViewed = get_post( $most->id );
|
||||
$less = $wpdb->get_row(
|
||||
"SELECT sum(count) views, id FROM `wp_statistics_pages` where id not in ( 0,1,3)
|
||||
group BY `wp_statistics_pages`.`id` order by views asc limit 1"
|
||||
);
|
||||
$postLessViewed = get_post( $less->id );
|
||||
$rand = $wpdb->get_row(
|
||||
"SELECT * FROM `wp_posts` where post_status = 'publish' and post_type = 'post' and id not in ( $postMostViewed->ID, $postLessViewed->ID ) order by rand() limit 1"
|
||||
);
|
||||
$postRandViewed = get_post( $rand->ID ); ?>
|
||||
<main class="content" id="main">
|
||||
<article class="container">
|
||||
<div class="row">
|
||||
<div class="col-lg-12 col-xs-12">
|
||||
|
||||
<h2>Błąd 404</h2>
|
||||
<?php get_template_part('template-parts/content/content-none'); ?>
|
||||
|
||||
</div>
|
||||
<div class="col-lg-12 col-xs-12">
|
||||
|
||||
<h5>Jeśli nie znalazłeś interesującego artykułu możesz zajrzeć do jedego z poniższych</h5>
|
||||
|
||||
|
||||
</div>
|
||||
<div class="col-lg-4 col-xs-12">
|
||||
<a href="<?php echo esc_url( get_permalink($postMostViewed->ID) ); ?>">
|
||||
<?php echo get_the_post_thumbnail( $postMostViewed->ID, 'thumbnail', array( 'class' => 'alignleft' ) ); ?>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-lg-4 col-xs-12">
|
||||
<a href="<?php echo esc_url( get_permalink($postLessViewed->ID) ); ?>">
|
||||
<?php echo get_the_post_thumbnail( $postLessViewed->ID, 'thumbnail', array( 'class' => 'alignleft' ) ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-lg-4 col-xs-12">
|
||||
<a href="<?php echo esc_url( get_permalink($postRandViewed->ID) ); ?>">
|
||||
<?php echo get_the_post_thumbnail( $postRandViewed->ID, 'thumbnail', array( 'class' => 'alignleft' ) ); ?>
|
||||
</a>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
</article>
|
||||
</main>
|
||||
<?php get_footer();
|
||||
Reference in New Issue
Block a user