Is it possible to show sort page excerpt in search.php

Question

Current I have my search just return the title of the page that has the result, is there a way to show an excerpt

This is what i have

<?php get_header(); ?>


<section class="page-wrap">
    <div class="container">
        <div class="col-lg-9 section-space--ptb_30">

            <?php
            $s=get_search_query();
            $args = array(
                            's' =>$s
                        );
                // The Query
            $the_query = new WP_Query( $args );
            if ( $the_query->have_posts() ) {
                    _e("<h2 style='padding-bottom:20px;'>Search Results for '".get_query_var('s')."'</h2>");
                    while ( $the_query->have_posts() ) {
                       $the_query->the_post();
                             ?>
                                
                                    <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a>
                              
                             <?php
                    }
                }else{
            ?>
                    <h2 style='font-weight:bold;color:#000'>Nothing Found</h2>
                    <div class="alert alert-info">
                      <p>Sorry, but nothing matched your search criteria. Please try again with some different keywords.</p>
                    </div>
            <?php } ?>

        </div>

    </div>

</section>

<?php get_footer(); ?>

0
, Milly Roc 3 years 2020-07-16T15:11:15-05:00 0 Answers 49 views 0

Leave an answer

Browse
Browse