Advertisement
Guest User

Custom tag page hook

a guest
Aug 26th, 2014
15
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.46 KB | None | 0 0
  1. /* Replace template with newsletter template if tagged with "road runner" */
  2. if ( ! function_exists( 'newsletter_template' ) ) :
  3. function newsletter_template( $template )
  4. {
  5.     if( preg_match("/.*road.*runner.*/i", get_query_var('tag')) )
  6.     {
  7.         $new_template = locate_template( array( 'newsletter.php' ) );
  8.         if ( '' != $new_template ) {
  9.             return $new_template ;
  10.         }
  11.     }
  12.  
  13.     return $template;
  14. }
  15. endif;
  16. add_filter( 'template_include', 'newsletter_template', 99);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement