Search shows products like blog posts
-
I can’t seem to be able fix this issue on my site. Whenever I search for products on my site, they show up like blog posts in search results. How can I fix this?
The page I need help with: [log in to see the link]
-
Hello @arbinqadeer
Thank you for reaching out to us.
As the search result page is an archive page, to customize the search result, please have a look at this reference screencast.
With Regards
Humayon@humayonk tried every option in that setting, and it still shows it with “read more” and “posted by”. You can go to the page and see. It still doesn’t show like a product.
Hi @arbinqadeer
Thank you for your reply.
Well, can you please confirm that you have followed the screencast I have shared in my previous reply?
If yes and still facing an issue, then to debug further and provide you with a better solution, can you please export and share your customizer setting with us by following this documentation?
With Regards
HumayonYes. I followed those exact steps and the problem persists.
Please have a look at the setting file:
Hello @arbinqadeer
Thank you for your reply.
I have checked your site further, and it seems you’re using the Astra Pro.
Based on the forum guidelines, we can’t review paid or commercial support issues here.
So, can you please get in touch with our Team here?
That will help us assist you more effectively.
With Regards
Humayon`I have to thank Astra forum for being not helpful at all and being so miser about helping someone out.
Luckily, there’s ChatGPT and it helped me with changing my code in search.php to:
<?php
/**
* Search results template
*
* @package Astra
*/
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
get_header();
?>
<div id="primary" <?php astra_primary_class(); ?>>
<?php astra_primary_content_top(); ?>
<?php if ( have_posts() ) : ?>
<header class="page-header ast-archive-header">
<h1 class="page-title ast-archive-title">
<?php printf( esc_html__( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ); ?>
</h1>
</header>
<div class="woocommerce columns-4">
<?php
woocommerce_product_loop_start();
while ( have_posts() ) :
the_post();
if ( 'product' === get_post_type() ) {
wc_get_template_part( 'content', 'product' );
}
endwhile;
woocommerce_product_loop_end();
?>
</div>
<?php astra_pagination(); ?>
<?php else : ?>
<header class="page-header ast-archive-header">
<h1 class="page-title ast-archive-title">
<?php printf( esc_html__( 'Search Results for: %s', 'astra' ), '<span>' . get_search_query() . '</span>' ); ?>
</h1>
</header>
<p><?php esc_html_e( 'No products found.', 'astra' ); ?></p>
<?php endif; ?>
<?php astra_primary_content_bottom(); ?>
</div><!-- #primary -->
<?php get_footer(); ?>Hi @arbinqadeer
Thank you for writing to us.
We’re glad to hear that the ChatGPT code resolved the issue.
But we want to let you know that you don’t need to use such a custom code, as something else, such as a third-party plugin conflict or custom code in a child theme, might cause such an issue.
Can you please check the same on your end and confirm, as we are unable to reproduce the same issue on our end.
With Regards
Humayon
You must be logged in to reply to this topic.
