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

Don't show metadata for non-posts #285

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
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
55 changes: 29 additions & 26 deletions templates/search.php
Original file line number Diff line number Diff line change
@@ -1,26 +1,29 @@
<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
<h1 class="govuk-heading-l">Search results for <?php the_search_query(); ?> </h1>

<?php if (have_posts()) { ?>

<?php while (have_posts()) : the_post() ?>
<article <?php post_class() ?>>
<header>
<h3 class="govuk-heading-m"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
<?php get_template_part('templates/entry-meta') ?>
<?php if (has_post_thumbnail()) {
the_post_thumbnail('large');
} ?>
</header>
<?php the_excerpt() ?>
<?php get_template_part('templates/entry-footer') ?>
</article>
<?php endwhile ?>

<?php } else { ?>
<article>
<p class="govuk-body">No results found on <strong><?php echo get_bloginfo('name'); ?></strong>.</p>
<p>Please try searching again using different words or try this search on <a href="https://www.gov.uk/">GOV.UK</a>.</p>
</article>
<?php } ?>

<hr class="govuk-section-break govuk-section-break--l govuk-section-break--visible">
<h1 class="govuk-heading-l">Search results for <?php the_search_query(); ?> </h1>
<?php
if (have_posts()) {
while (have_posts()) {
the_post(); ?>
<article <?php post_class() ?>>
<header>
<h3 class="govuk-heading-m"><a href="<?php the_permalink() ?>"><?php the_title() ?></a></h3>
<?php
if (is_single()) {
get_template_part('templates/entry-meta');
}
if (has_post_thumbnail()) {
the_post_thumbnail('large');
} ?>
</header>
<?php the_excerpt() ?>
<?php get_template_part('templates/entry-footer') ?>
</article>
<?php
}
} else { ?>
<article>
<p class="govuk-body"><?php echo __("No results found on"); ?><strong><?php echo get_bloginfo('name'); ?></strong>.</p>
<p><?php echo __("Please try searching again using different words or try this search on"); ?> <a href="https://www.gov.uk/">GOV.UK</a>.</p>
</article>
<?php
}
Loading