Title: ayman1's Replies | WordPress.org

---

# ayman1

  [  ](https://wordpress.org/support/users/ayman1/)

 *   [Profile](https://wordpress.org/support/users/ayman1/)
 *   [Topics Started](https://wordpress.org/support/users/ayman1/topics/)
 *   [Replies Created](https://wordpress.org/support/users/ayman1/replies/)
 *   [Reviews Written](https://wordpress.org/support/users/ayman1/reviews/)
 *   [Topics Replied To](https://wordpress.org/support/users/ayman1/replied-to/)
 *   [Engagements](https://wordpress.org/support/users/ayman1/engagements/)
 *   [Favorites](https://wordpress.org/support/users/ayman1/favorites/)

 Search replies:

## Forum Replies Created

Viewing 1 replies (of 1 total)

 *   Forum: [Themes and Templates](https://wordpress.org/support/forum/themes-and-templates/)
   
   In reply to: [Switching themes](https://wordpress.org/support/topic/switching-themes-4/)
 *  Thread Starter [ayman1](https://wordpress.org/support/users/ayman1/)
 * (@ayman1)
 * [14 years, 10 months ago](https://wordpress.org/support/topic/switching-themes-4/#post-2321777)
 * Turns out that, since 2.5.0, there is a function called switch_theme()! It’s 
   in wp-includes/theme.php:
 * _[Code moderated as per the [Forum Rules](http://codex.wordpress.org/Forum_Welcome#Posting_Code).
   Please use the [pastebin](http://wordpress.pastebin.com/)]_
 * So, it looks like the main thing I was missing was the do_action() at the end.
   So, the code should be:
 *     ```
       $theme = get_theme_of_today();
       switch_themes($theme['Template'], $theme['Stylesheet']);
       function get_theme_of_today() {
          $day = (int) date('z');
          $themes = get_themes();
          $i = $day % count($themes);
          return $themes[$i];
       }
       ```
   

Viewing 1 replies (of 1 total)