Adding a title to my search.php
-
Hi everyone!
I am trying to customize my search results page in the twenty twenty theme and I have developed this search.php
<?php /** * Template Name: Search Page <div class="search-post-link" style="margin-bottom: 10px;"><a href="<?php the_permalink(); ?>"><?php the_permalink(); ?></a></div> */ ?> <?php get_header(); ?> <main id="site-content" role="main"> <?php /* Start the Loop */ ?> <style> p { margin-left:auto; margin-right:auto; max-width:58rem; width: calc(100% - 4rem); text-align:left; } </style> <?php while ( have_posts() ) : the_post(); ?> <div class="container" style="font-size: 21px;"> <div class="row"> <div class="col-md-12"> <header class="entry-header has-text-align-center"> <h3><a href="<?php the_permalink(); ?>" style="color:#fff"><?php the_title(); ?></a></h3> </header> <div class="search-post-excerpt has-text-align-center" style="color:#fff"> <p> <?php the_excerpt(); ?> </p> </div> <hr> </div> </div> </div> <?php endwhile; ?> the_posts_pagination( array( 'prev_text' => twentyseventeen_get_svg( array( 'icon' => 'arrow-left' ) ) . '<span class="screen-reader-text">' . __( 'Previous page', 'twentyseventeen' ) . '</span>', 'next_text' => '<span class="screen-reader-text">' . __( 'Next page', 'twentyseventeen' ) . '</span>' . twentyseventeen_get_svg( array( 'icon' => 'arrow-right' ) ), 'before_page_number' => '<span class="meta-nav screen-reader-text">' . __( 'Page', 'twentyseventeen' ) . ' </span>', ) ); <?php get_footer();
Now I want there to be a title confirming what the user searched for in the header however I have only successfully placed it above or below the header. The code for the title would be the following:
"Search for: "<?php the_search_query(); ?>"";
but I don’t know how to put it in the header with white color.
Also I am localhosting my site so I can’t share it but I hope I have provided enough information for you to see what I mean.
Thanks in advance!
Viewing 5 replies - 1 through 5 (of 5 total)
Viewing 5 replies - 1 through 5 (of 5 total)
- The topic ‘Adding a title to my search.php’ is closed to new replies.