/** * Set active theme. * * @since 1.0.0 * @access public */ public function set_initial_active_theme() { global $wpdb; $theme = $wpdb->get_row("SELECT ID FROM {$wpdb->posts} WHERE post_type='tf_theme' AND post_status='publish'"); if (!is_null($theme)) { TF_Model::set_active_theme($theme->ID); TF_Model::create_stylesheets($theme->ID); } }
/** * Activate TF Theme. * * @since 1.0.0 * @access public * */ public function set_active_theme($post_id) { // Activate theme TF_Model::set_active_theme($post_id); // set false to other themes $themes = get_posts(array('post_type' => $this->post_type, 'posts_per_page' => -1, 'post__not_in' => array($post_id), 'meta_query' => array(array('key' => 'tf_active_theme', 'value' => 'true')))); if (count($themes) > 0) { foreach ($themes as $theme) { TF_Model::set_active_theme($theme->ID, false); } } // clear theme cached $this->delete_theme_cached($post_id); }