mbcreation

No result alert

Jun 17th, 2016
186
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.65 KB | None | 0 0
  1. <?php
  2.  
  3. // search.php template file
  4.  
  5. get_header(); ?>
  6.  
  7. <h1>Résultas de la recherche pour  : <?php echo get_search_query();?></h1>
  8.  
  9. <?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
  10.            
  11.             <h2><a href="<?php the_permalink();?>"><?php the_title();?></a></h2>
  12.            
  13.             <p><?php the_excerpt(); ?></p>
  14.            
  15.             <?php endwhile; else: ?>
  16.            
  17.             <p>Aucun résultat</p>
  18.            
  19.             <?php
  20.             // Ajout d'une alerte email        
  21.             wp_mail( get_option('admin_email'), 'Alerte recherche sans résultats', get_search_query() );
  22.  
  23.             ?>
  24.  
  25. <?php endif; ?>
  26.  
  27. <?php get_footer(); ?>
Advertisement
Add Comment
Please, Sign In to add comment