Inital layout of home page
This commit is contained in:
@@ -1,68 +1,45 @@
|
||||
<?php
|
||||
global $wp_query;
|
||||
get_header();
|
||||
$query = $_GET['s'];
|
||||
$results = $wp_query->found_posts;
|
||||
?>
|
||||
<main class="page">
|
||||
<section class="page__logo">
|
||||
<?php get_template_part('partials/logo') ?>
|
||||
</section>
|
||||
<section class="page__content">
|
||||
<div class="content">
|
||||
<?php if ($results === 0) : ?>
|
||||
<h1 class="title">Sorry, no results found.</h1>
|
||||
<a class="link" href="<?php echo get_site_url() ?>/">Go back home</a>
|
||||
<?php else : ?>
|
||||
<h1 class="title">
|
||||
<?php
|
||||
$query = $_GET['s'];
|
||||
echo $wp_query->found_posts.' results matching "' . $query . '" found.';
|
||||
echo $results.' result'.($results !== '1' ? 's' : '').' matching "' . $query . '" found.';
|
||||
?>
|
||||
</h1>
|
||||
<ol>
|
||||
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
|
||||
<?php $username = get_the_author_meta('nickname') ?>
|
||||
<?php $date = get_the_date('jS F, Y', $id).' at '.get_the_date('H:i', $id) ?>
|
||||
<li>
|
||||
<div class="excerpt">
|
||||
<div class="excerpt__head">
|
||||
<div class="excerpt__title">
|
||||
<a class="link" href="<?php the_permalink(); ?>">
|
||||
<?php the_title(); ?>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class="excerpt__body">
|
||||
<?php echo the_excerpt() ?>
|
||||
</div>
|
||||
<div class="excerpt__foot">
|
||||
<p class="excerpt__metadata">
|
||||
<span class="excerpt__icon">
|
||||
<svg class="icon icon--extra-small" aria-hidden="true">
|
||||
<use xlink:href="#icon-profile"></use>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="excerpt__text"><?php echo $username ?></span>
|
||||
<span class="excerpt__icon">
|
||||
<svg class="icon icon--extra-small" aria-hidden="true">
|
||||
<use xlink:href="#icon-calendar"></use>
|
||||
</svg>
|
||||
</span>
|
||||
<span class="excerpt__text"><?php echo $date ?></span>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<?php endwhile; ?>
|
||||
</ol>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<ol>
|
||||
<?php if (have_posts()): while (have_posts()) : the_post(); ?>
|
||||
<li>
|
||||
<?php
|
||||
$excerpt = array(
|
||||
title => get_the_title(),
|
||||
url => get_the_permalink(),
|
||||
content => get_the_excerpt(),
|
||||
author => get_the_author_meta('nickname'),
|
||||
comments => get_comments_number(),
|
||||
date => get_the_date('jS F, Y', $id) . ' at ' . get_the_date('H:i', $id),
|
||||
);
|
||||
get_template_part('partials/excerpt')
|
||||
?>
|
||||
</li>
|
||||
<?php endwhile; endif; ?>
|
||||
</ol>
|
||||
</section>
|
||||
<section class="page__pagination">
|
||||
<?php get_template_part('partials/pagination') ?>
|
||||
</section>
|
||||
<?php else: ?>
|
||||
<section class="page__content">
|
||||
<div class="content">
|
||||
<h1 class="title">Sorry, no results found.</h1>
|
||||
<a class="link" href="<?php echo get_site_url() ?>/">Go back home</a>
|
||||
</div>
|
||||
</section>
|
||||
<?php endif; ?>
|
||||
<section class="page__banner">
|
||||
<?php get_template_part('partials/banner') ?>
|
||||
</section>
|
||||
|
||||
Reference in New Issue
Block a user