Custom search.php in child theme not overriding Astra parent

[ad_1]

I’m trying to build a custom search results page so I created an empty **search.php** file in my Astra child theme and just put “Hello!” as the only content. I expected to see a totally blank page that says “Hello!”. But, I’m not seeing any change in the search results page.

This is on LOCALHOST in LocalWP (not online), so I can’t share a link.

I have cleared the browser cache and flushed the DNS as well as disabling caching in Chrome’s “Network” tab. There’s also a custom code snippet to “Purge Cache” from WebSquadron that I ran, all to seemingly no effect.

I’m using Astra theme. If it helps, this is Astra’s default search.php:

<?php
/**
* The template for displaying search results pages.
*
* @link
*
* @package Astra
* @since 1.0.0
*/

if ( ! defined( ‘ABSPATH’ ) ) {
exit; // Exit if accessed directly.
}

get_header(); ?>

<?php if ( astra_page_layout() == ‘left-sidebar’ ) : ?>

<?php get_sidebar(); ?>

<?php endif ?>

<div id=”primary” <?php astra_primary_class(); ?>>

<?php astra_primary_content_top(); ?>

<?php astra_archive_header(); ?>

<?php astra_content_loop(); ?>

<?php astra_pagination(); ?>

<?php astra_primary_content_bottom(); ?>

</div><!– #primary –>

<?php if ( astra_page_layout() == ‘right-sidebar’ ) : ?>

<?php get_sidebar(); ?>

<?php endif ?>

<?php get_footer(); ?>

&#x200B;

[Astra search.php, Astra parent and child theme folder structure in left sidebar in VSCode])

Thanks for any help!

[ad_2]

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer