phpWordpress

Displaying WordPress Custom Search Results

The Custom Search Template and The Page Template are vital to any complete WordPress Theme.

To create your own custom Search Page, you will need to create a Page template to include your search form and the information you want your users to see before they search your site.

<?php
get_header();
global $wp_query;
?>
<section class="about-institute">
    <div class="container">
        <div class="row">
        <div class="col-md-12 welcome">
        
		<h3 class="panel-title inner-title"><?php echo $wp_query->found_posts; ?>
        <?php _e( 'Search Results Found For', 'locale' ); ?>: "<?php the_search_query(); ?>"</h3>
 
        <?php if ( have_posts() ) { ?>

            <ul class="search-result">

            <?php while ( have_posts() ) { the_post(); ?>

               <li>
                 <h3><a href="<?php echo get_permalink(); ?>">
                   <?php the_title();  ?>
                 </a></h3>
                 <?php  the_post_thumbnail('medium') ?>
                 <?php echo substr(get_the_excerpt(), 0,200); ?>
                 <div class="h-readmore"> <a href="<?php the_permalink(); ?>">Read More</a></div>
               </li>

            <?php } ?>

            </ul>
           <div class="pagination"><?php echo paginate_links(); ?></div>
        <?php } ?>
        
        </div>

    </div>
  </div>
</section>
<?php get_footer(); ?>
  • Mastering Float Output Formatting Flags in C++

    Introduction: When it comes to displaying floating-point numbers in C++, precision and formatting are key. C++ provides various formatting flags that allow you to control how floating-point numbers are presented in output streams. In this blog post, we’ll delve into the world of float output formatting flags in C++, exploring their usage through practical examples.…

  • Understanding Exception::what() in C++

    Introduction: Handling exceptions is an essential aspect of robust programming in C++. When an exception occurs, it’s crucial to provide meaningful information about the error to aid in debugging and error recovery. The what() function, part of the std::exception class in C++, plays a significant role in this process. In this blog post, we’ll explore…

  • Implementing Iterative Quick Sort in C++

    Introduction: Sorting algorithms are fundamental in computer science, playing a crucial role in various applications from databases to search algorithms. Among the myriad of sorting techniques, Quick Sort stands out for its efficiency and simplicity. In this article, we’ll delve into implementing Quick Sort iteratively in C++, a versatile and powerful programming language. What is…

  • Exploring Advanced PHP Techniques: A Deep Dive into Modern PHP Development

    Introduction: PHP, despite being one of the oldest web development languages, has evolved significantly over the years. With each new version, PHP introduces powerful features and enhancements, making it a robust choice for modern web applications. In this blog post, we’ll explore some advanced PHP techniques that can help developers build efficient, scalable, and secure…

  • 5 Innovative Uses of Artificial Intelligence in Healthcare

    Introduction: Artificial Intelligence (AI) has been revolutionizing various industries, and one of the sectors that have benefited significantly is healthcare. From enhancing diagnostic accuracy to streamlining administrative tasks, AI is reshaping the way healthcare services are delivered. In this blog post, we’ll explore five innovative uses of AI in healthcare that are making a significant…

  • Understanding PHP Session & Cookies: A Comprehensive Guide with Examples

    In web development, managing user data and interactions is crucial for building dynamic and personalized experiences. PHP offers powerful tools for handling user sessions and cookies, which are essential for maintaining state across multiple page requests. In this guide, we’ll delve into PHP sessions and cookies, explaining their concepts and providing practical examples to illustrate…

Related Articles

Leave a Reply

Your email address will not be published. Required fields are marked *

Back to top button