Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 15th, 2012  |  syntax: None  |  size: 1.14 KB  |  hits: 13  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. <?php $photosearch = $_POST['photoSearchInput']; ?>
  2.  
  3. <div class="photoSearch">
  4.   <form name="photoSearchName" action="<?php bloginfo('url'); ?>/multimedia/photo-gallery/" method="post">
  5.     <label for="photoSearchInput">Search:</label><input type="text" name="photoSearchInput" id="photoSearchInput" value="<?php echo $photosearch; ?>"/>
  6.     <input type="submit" value="submit"/>
  7.   </form>
  8. </div>
  9.  
  10. <?php
  11. if(isset($photosearch)){
  12.   // Start of NextGen Gallery search
  13.  
  14.           $search = $wp_query->get('photoSearchInput');
  15. echo $photosearch;
  16. echo $search;
  17.           $keywords = preg_replace('/\+/',' ',$photosearch);
  18.     if (function_exists ('ngg_get_search_pictures')) {  // function from functions.php           
  19.       $nggpictures = ngg_get_search_pictures($keywords, ''); // put the number of pictures by row you want, if you don't want "4"
  20.  
  21.                   echo "<h2>Pictures</h2>";
  22.                   if ($nggpictures) {
  23.                           echo $nggpictures;
  24.                           echo '<div class="clear">&nbsp;</div>';
  25.                   }
  26.                   else {
  27.                           echo '<p>No pictures were found.</p>';
  28.                   }
  29.           }
  30.  
  31.   // End of NextGen Gallery search
  32. }else{
  33.   echo "not searching";
  34. }//end else from if(isset($photosearch))
  35.   ?>