brasofilo

Swap theme according to page

Apr 27th, 2012
94
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php
  2. /*
  3.     Plugin Name: Trocar Tema
  4.     Version: 1.0
  5.     Author: brasofilo
  6.     Author URI: http://brasofilo.com
  7. */
  8.  
  9. /* Trocar de tema conforme a página */
  10. $count = 0;
  11. function change_theme( $template = '' ) {
  12.     global $post,$count;
  13.     if ( is_page('SLUG-DA-PAGINA') ) {
  14.         if($count==0) {
  15.             $template = 'twentyeleven';
  16.             $count++;
  17.         }
  18.     }
  19.     return $template;
  20. }
  21. add_filter('template', 'change_theme');
  22. add_filter('option_template', 'change_theme');
  23. add_filter('option_stylesheet', 'change_theme');
RAW Paste Data