/** * Checks if stylesheet exist. Creates it if it doesn't. * * ## EXAMPLES * * wp themifyflow make_css * * @synopsis */ function make_css($args, $assoc_args) { if (class_exists('TF_Styling_Control')) { if (TF_Model::create_stylesheets()) { WP_CLI::success("Stylesheet succesfully created."); } else { WP_CLI::error("Could not create stylesheet."); } } }
/** * 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 action. * * @since 1.0.0 * @access public */ public function activate_theme() { if (isset($_GET['action']) && 'activate_tf_theme' == $_GET['action'] && wp_verify_nonce($_GET['_wpnonce'], 'tf_theme_nonce')) { $post_id = (int) $_GET['post']; $this->set_active_theme($post_id); wp_redirect(add_query_arg(array('page' => 'tf-themes', 'action' => 'tf_theme_activated'), admin_url('admin.php'))); exit; } elseif (isset($_GET['action']) && 'tf_theme_activated' == $_GET['action']) { TF_Model::create_stylesheets(); } }