Once You Know, You Newegg

WordPress – Show search term

Paste this in your search.php theme template or wherever you need it.

Results for <?php echo $_GET[‘s’] ?>

The $_GET[‘s’] is obviously the search term that was entered into the search box.

This will display the Search Term used that inspired the creation of the resulting page.

WP – “X” on home page only

Below code allows me to display something or execute something only on the home or front page of a site.

<?php if ( is_front_page() ) { ?>
Insert a “home page only” item.
<?php } else { ?>
Insert what appears on the rest on the pages/posts.
<?php } ?>

This can be easily added into a templates single.php, page.php, header.php, footer.php or where ever you need it.

A great use for this is banners.

For example: I want a small flash presentation to play once and not repeat as the site is navigated.

Using the above tag, I can create a quick solution.

<?php if ( is_front_page() ) { ?>
<img src=”an_image_or_flash_embed_for_only_home_page.png”>
<?php } else { ?>
<img src=”another_image_or_flash_embed_for_the_rest.png”>
<?php } ?>