Skip to content

Commit

Permalink
Updated search form.
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanbohacek committed Nov 19, 2020
1 parent 675a3a7 commit 5d28a85
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
16 changes: 15 additions & 1 deletion search.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,21 @@
?>
<main role="main" class="container-fluid m-0 p-0">
<div class="container">
<h1 class="post-title"><?php echo sprintf( __( '%s Search Result(s) for ', 'botwiki' ), number_format( $wp_query->found_posts ) ); echo '<em>'. $search_query . '</em>'; ?></h1>
<h1 class="post-title"><?php

$found_posts = $wp_query->found_posts;
$title = '';

if ( $found_posts === 0 ){
$title = "Nothing found for <em>$search_query</em>";
} elseif ( $found_posts === 1 ) {
$title = "One result found for <em>$search_query</em>";
} else {
$title = "number_format( $found_posts )results found for <em>$search_query</em>";
}

echo $title;
?></h1>
<div class="post-content">
<?php

Expand Down
2 changes: 1 addition & 1 deletion searchform.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<link itemprop="url" href="https://botwiki.org/"/>
<form class="search-form<?php
if ( is_search() ){
echo ' pl-3 pr-3 ';
echo ' search-form px-5 pt-3 pb-5 bg-light ';
}
?>" itemprop="potentialAction" itemscope itemtype="http://schema.org/SearchAction" class="form mt-5 mt-md-0 mb-5 text-right pr-0 w-100" method="get" action="<?php echo home_url(); ?>" role="search">
<meta itemprop="target" content="https://botwiki.org/?s={s}"/>
Expand Down

0 comments on commit 5d28a85

Please sign in to comment.