Advertisement
Guest User

Untitled

a guest
Jun 7th, 2013
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.10 KB | None | 0 0
  1. <?php
  2.  
  3.     function cp_template_redirect() {
  4.         global $post;
  5.  
  6.         // organization single
  7.         if (is_single() && $post->post_type == 'organizations')
  8.         {
  9.            
  10.             $base = 'casepress/cp-templates/default';
  11.             $includes = implode( '/', array( WP_PLUGIN_DIR, $base ) );
  12.             include_once $includes.'/hooks.php';
  13.             load_template( $includes.'/template-organization.php', true );
  14.             die;
  15.         }
  16.        
  17.         // cases single
  18.         if (is_single())
  19.             if ($post->post_type == 'cases')
  20.             {
  21.                 $base = 'casepress/cp-templates/default';
  22.                 $includes = implode( '/', array( WP_PLUGIN_DIR, $base ) );
  23.                 include_once $includes.'/hooks.php';
  24.                 load_template( $includes.'/single-cases.php', true );
  25.                 die;
  26.             }
  27.  
  28.         // cases table
  29.         if ($post->post_type == 'page')
  30.             if ($post->ID == get_option('page_for_cases_list'))
  31.             {
  32.                
  33.                 $base = 'casepress/cp-templates/default';
  34.                 $includes = implode( '/', array( WP_PLUGIN_DIR, $base ) );
  35.                 include_once $includes.'/hooks.php';
  36.                 load_template( $includes.'/template-cases.php', true );
  37.                 die;
  38.             }
  39.     }
  40.     add_action('template_redirect', 'cp_template_redirect', 10);
  41. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement