Advertisement
neatekFb

Change Wordpress theme only for one user, ex. for developer.

Jun 7th, 2017
159
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.69 KB | None | 0 0
  1. <?php
  2. // Vladimir Zhelnov // neatek.ru // neatek.pw
  3. // create a new folder in wp-content/plugins
  4. // create a new file index.php
  5. // some changes&copy&paste
  6.  
  7. add_filter('template', 'change_theme');
  8. add_filter('option_template', 'change_theme');
  9. add_filter('option_stylesheet', 'change_theme');
  10.  
  11. function change_theme($theme) {
  12.     if (get_current_user_id() == 4) { // here is 4 is user_id of Developer
  13.         $theme = 'here is a name of the folder which contain new theme files.'; // theme for only one user for develop a new theme
  14.     }
  15.     else {
  16.         $theme = 'here is a name of the folder which contain standart theme files.'; // standart theme for all users
  17.     }
  18.  
  19.     return $theme;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement