function show_box1() { $android_Theme = get_option('cart_android_theme'); $iphone_Theme = get_option('cart_iphone_theme'); $ipad_Theme = get_option('cart_ipad_theme'); $themes = wp_get_themes(); ?> <div class="inside"> <p><?php _e('Android Phone Theme Setup', 'WP-OliveCart'); ?> </p> <select name="android_theme"> <?php foreach ($themes as $theme) { if ($android_Theme == $theme['Name'] || $android_Theme == '' && $theme['Name'] == get_current_theme()) { echo '<option value="' . $theme['Name'] . '" selected="selected">' . $theme['Name'] . '</option>'; } else { echo '<option value="' . $theme['Name'] . '">' . $theme['Name'] . '</option>'; } } ?> </select> </div> <?php }
function gitium_update_versions() { // get all themes from WP $all_themes = wp_get_themes(array('allowed' => true)); foreach ($all_themes as $theme_name => $theme) { $theme_versions[$theme_name] = array('name' => $theme->Name, 'version' => null, 'msg' => ''); $theme_versions[$theme_name]['msg'] = '`' . $theme->Name . '`'; $version = $theme->Version; if (!empty($version)) { $theme_versions[$theme_name]['msg'] .= " version {$version}"; $theme_versions[$theme_name]['version'] .= $version; } } if (!empty($theme_versions)) { $new_versions['themes'] = $theme_versions; } // get all plugins from WP if (!function_exists('get_plugins')) { require_once ABSPATH . 'wp-admin/includes/plugin.php'; } $all_plugins = get_plugins(); foreach ($all_plugins as $name => $data) { $plugin_versions[$name] = array('name' => $data['Name'], 'version' => null, 'msg' => ''); $plugin_versions[$name]['msg'] = "`{$data['Name']}`"; if (!empty($data['Version'])) { $plugin_versions[$name]['msg'] .= ' version ' . $data['Version']; $plugin_versions[$name]['version'] .= $data['Version']; } } if (!empty($plugin_versions)) { $new_versions['plugins'] = $plugin_versions; } set_transient('gitium_versions', $new_versions); return $new_versions; }
function sb_switch_to_default_theme() { $themes = wp_get_themes(); $wp_theme = ''; foreach ($themes as $theme) { $author_uri = $theme->get('AuthorURI'); if (false !== strrpos($author_uri, 'wordpress.org')) { $wp_theme = $theme; break; } } if (empty($wp_theme)) { foreach ($themes as $theme) { $text_domain = $theme->get('TextDomain'); if (false === strrpos($text_domain, 'sb-theme')) { $wp_theme = $theme; break; } } } $theme = $wp_theme; if (!empty($theme)) { switch_theme($theme->get('TextDomain')); } }
function jptb_register_settings() { add_settings_section('jptb_theme_choice', __('Which Themes Do You Want To Show?', 'jptb'), array($this, 'themeChoice_HTML'), 'jptb_settings'); add_settings_section('jptb_other_options', __('Additional Options', 'jptb'), array($this, 'other_options_HTML'), 'jptb_settings'); $themes = wp_get_themes(); foreach ($themes as $theme) { //the preperation $themename = $theme['Name']; $noSpaceName = strtr($themename, " -", "__"); $nocapsname = strtolower($noSpaceName); $uniqueOptionName = "jptb_" . $nocapsname; //This will have to loop, make a create settings field function and pass the field ID add_settings_field($uniqueOptionName, $themename, array($this, 'Theme_field_HTML'), 'jptb_settings', 'jptb_theme_choice', $uniqueOptionName); register_setting('jptb_settings', $uniqueOptionName); } //LABEL TEXT TO USE add_settings_field('jptb_label', __('Label For Theme Bar', 'jptb'), array($this, 'label_cb'), 'jptb_settings', 'jptb_other_options'); register_setting('jptb_settings', 'jptb_label'); //MAIN BG COLOUR add_settings_field('jptb_bg_colour', __('Background Colour', 'jptb'), array($this, 'bg_cb'), 'jptb_settings', 'jptb_other_options'); register_setting('jptb_settings', 'jptb_bg_colour'); //MAIN TXT COLOUR add_settings_field('jptb_text_colour', __('Text Colour', 'jptb'), array($this, 'txt_cb'), 'jptb_settings', 'jptb_other_options'); register_setting('jptb_settings', 'jptb_text_colour'); //LABEL BG COLOUR add_settings_field('jptb_label_bg_colour', __('Label Background Colour', 'jptb'), array($this, 'label_bg_cb'), 'jptb_settings', 'jptb_other_options'); register_setting('jptb_settings', 'jptb_label_bg_colour'); //LABEL TEXT COLOR add_settings_field('jptb_label_text_colour', __('Label Text Colour', 'jptb'), array($this, 'label_txt_cb'), 'jptb_settings', 'jptb_other_options'); register_setting('jptb_settings', 'jptb_label_text_colour'); //LABEL TEXT COLOR add_settings_field('jptb_mod_switch', __('Update Theme Mods', 'jptb'), array($this, 'mod_switch_cb'), 'jptb_settings', 'jptb_other_options'); register_setting('jptb_settings', 'jptb_mod_switch'); }
function get_post_templates() { $themes = wp_get_themes(); $theme = get_option('template'); $templates = $themes[$theme]['Template Files']; $post_templates = array(); if (is_array($templates)) { $base = array(trailingslashit(get_template_directory()), trailingslashit(get_stylesheet_directory())); foreach ($templates as $template) { $basename = str_replace($base, '', $template); if ($basename != 'functions.php') { // don't allow template files in subdirectories if (false !== strpos($basename, '/')) { continue; } if ($basename == 'post_templates.php') { continue; } $template_data = implode('', file($template)); $name = ''; if (preg_match('|Single Post Template:(.*)$|mi', $template_data, $name)) { $name = _cleanup_header_comment($name[1]); } if (!empty($name)) { $post_templates[trim($basename)] = $name; } } } } return $post_templates; }
/** * @access public */ public function prepare_items() { $themes = wp_get_themes( array( 'allowed' => true ) ); if ( ! empty( $_REQUEST['s'] ) ) $this->search_terms = array_unique( array_filter( array_map( 'trim', explode( ',', strtolower( wp_unslash( $_REQUEST['s'] ) ) ) ) ) ); if ( ! empty( $_REQUEST['features'] ) ) $this->features = $_REQUEST['features']; if ( $this->search_terms || $this->features ) { foreach ( $themes as $key => $theme ) { if ( ! $this->search_theme( $theme ) ) unset( $themes[ $key ] ); } } unset( $themes[ get_option( 'stylesheet' ) ] ); WP_Theme::sort_by_name( $themes ); $per_page = 36; $page = $this->get_pagenum(); $start = ( $page - 1 ) * $per_page; $this->items = array_slice( $themes, $start, $per_page, true ); $this->set_pagination_args( array( 'total_items' => count( $themes ), 'per_page' => $per_page, 'infinite_scroll' => true, ) ); }
public function pre_set_site_transient_update_themes($data) { // // Only run after other themes are checked. // if (empty($data->checked)) { return $data; } Themeco_Update_Api::refresh(); $update_cache = Themeco_Update_Api::get_update_cache(); if (!isset($update_cache['themes']) || !isset($update_cache['themes']['x'])) { return $data; } $themes = is_multisite() ? $this->multisite_get_themes() : wp_get_themes(); if (isset($themes['x'])) { $remote = $update_cache['themes']['x']; if (version_compare($remote['new_version'], $themes['x']->get('Version'), '<=')) { return $data; } if (!$remote['package']) { $remote['new_version'] = $remote['new_version'] . '<br/>' . X_Update_API::get_validation_html_theme_updates(); } $data->response['x'] = $remote; } return $data; }
function hellJustFrozeOver() { $error = error_get_last(); $currentTheme = wp_get_theme(); if ($error) { $foundOneFromTwentySeries = false; $themes = wp_get_themes(array('errors' => false, 'allowed' => null, 'blog_id' => 0)); foreach ($themes as $slug => $theme) { if (strpos($slug, 'twenty') !== false) { switch_theme($theme->get_stylesheet()); $foundOneFromTwentySeries = true; break; } } if (!$foundOneFromTwentySeries) { //dang, no theme from twenty series was present foreach ($themes as $slug => $theme) { if ($theme->get_stylesheet() != $currentTheme->get_stylesheet()) { switch_theme($theme->get_stylesheet()); break; } } } $fatalErrorMessage = "Your <b>{$currentTheme->Name}</b> theme threw a fatal error on <b>line #{$error['line']}</b> in {$error['file']}. The error message was: <b>{$error['message']}</b>. Please fix it.'"; update_option('fatalsafe', $fatalErrorMessage); echo "<h1>Don't Panic! Refresh This Page To Get Some Oxygen</h1>"; } }
/** * Activate admin notice */ public function activate_demo_extension_admin_notice() { global $blog_id; $themes = wp_get_themes($blog_id); if ('layerswp' !== get_template()) { ?> <div class="updated is-dismissible error"> <p><?php _e(sprintf("Layers is required to use the Demo Extension. <a href=\"%s\" target=\"_blank\">Click here</a> to get it.", isset($themes['layerswp']) ? admin_url('themes.php?s=layerswp') : "http://www.layerswp.com"), LAYERS_DEMO_EXTENSION_SLUG); ?> </p> </div> <?php } else { if (FALSE !== $this->update_required) { ?> <div class="updated is-dismissible error"> <p><?php _e(sprintf("Demo Extension requires Layers Version " . $this->update_required . ". <a href=\"%s\" target=\"_blank\">Click here</a> to get the Layers Updater.", "http://www.layerswp.com/download/layers-updater"), LAYERS_DEMO_EXTENSION_SLUG); ?> </p> </div> <?php } } }
protected function outputThemeList() { $themes = wp_get_themes(); foreach ($themes as $directory => $theme) { $mark = get_template() === $directory ? '*' : ' '; $this->line("{$mark} {$theme->name} [{$theme->version}] '{$directory}'"); } }
function getThemes($args) { if (function_exists("wp_get_themes")) { return wp_get_themes($args); } else { return get_themes(); } }
function get_themes() { if (false === ($result = get_transient('sk_' . SK_CACHE_PREFIX . '_get_themes'))) { $result = wp_get_themes(array('allowed' => true)); set_transient('sk_' . SK_CACHE_PREFIX . '_get_themes', $result, $this->cache_time); } return count($result); }
public function get_avaiable_themes() { if (function_exists('wp_get_themes')) { $this->avaiable_themes = wp_get_themes(); } else { $this->avaiable_themes = get_themes(); } }
/** * Utilities Page */ function utilities_page() { $themes = wp_get_themes(); ?> <div class="wrap"> <div id="icon-options-general" class="icon32"><br /></div> <h2>Make Exporter for Theme Foundry</h2> <?php echo $this->error . "<br>"; ?> <form action="" method="post" enctype="multipart/form-data"> <?php if (current_user_can('manage_options')) { wp_nonce_field('export'); if (isset($_POST['import_theme'])) { if (wp_verify_nonce($_REQUEST['_wpnonce'], 'import')) { $import_theme = esc_attr($_POST['import_theme']); if (strlen($_FILES['themeMods']['tmp_name']) > 0) { $mods = file_get_contents($_FILES['themeMods']['tmp_name']); $modArr = json_decode(sanitize_text_field($mods), true); if (is_array($modArr)) { update_option('theme_mods_' . $import_theme, $modArr); } else { echo "Theme modifications in uploaded file are not valid"; } } } else { echo "Possible resubmit or action not authorized."; } } echo "<p>Choose theme to export modifications:</p>"; echo "<p><select id='export_theme' name='export_theme'>"; foreach ($themes as $theme_slug => $theme) { echo "<option value='" . $theme_slug . "'>" . $theme->Name . "</option>"; } echo "</select></p>"; echo '<p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Export modifications"></p>'; echo '</form><form method="post" enctype="multipart/form-data">'; wp_nonce_field('import'); echo "<p>Warning! Importing theme modifications will overwrite current theme customizations. Please export if you want to save them.<br>Please select theme to import modifications:</p>"; echo "<p><select id='import_theme' name='import_theme'>"; foreach ($themes as $theme_slug => $theme) { echo "<option value='" . $theme_slug . "'>" . $theme->Name . "</option>"; } echo "</select></p>"; echo "<p>Choose modification file:</p>"; echo '<input type="file" name="themeMods">'; echo '<p class="submit"><input type="submit" name="submit" id="submit" class="button button-primary" value="Import modifications"></p>'; } else { echo "Not enough permissions. Please contact administrator to allow to manage options"; } ?> </form> </div> <?php }
/** * * @global string $status * @global array $totals * @global int $page * @global string $orderby * @global string $order * @global string $s */ public function prepare_items() { global $status, $totals, $page, $orderby, $order, $s; wp_reset_vars(array('orderby', 'order', 's')); $themes = array('all' => apply_filters('all_themes', wp_get_themes()), 'search' => array(), 'enabled' => array(), 'disabled' => array(), 'upgrade' => array(), 'broken' => $this->is_site_themes ? array() : wp_get_themes(array('errors' => true))); if ($this->is_site_themes) { $themes_per_page = $this->get_items_per_page('site_themes_network_per_page'); $allowed_where = 'site'; } else { $themes_per_page = $this->get_items_per_page('themes_network_per_page'); $allowed_where = 'network'; } $maybe_update = current_user_can('update_themes') && !$this->is_site_themes && ($current = get_site_transient('update_themes')); foreach ((array) $themes['all'] as $key => $theme) { if ($this->is_site_themes && $theme->is_allowed('network')) { unset($themes['all'][$key]); continue; } if ($maybe_update && isset($current->response[$key])) { $themes['all'][$key]->update = true; $themes['upgrade'][$key] = $themes['all'][$key]; } $filter = $theme->is_allowed($allowed_where, $this->site_id) ? 'enabled' : 'disabled'; $themes[$filter][$key] = $themes['all'][$key]; } if ($s) { $status = 'search'; $themes['search'] = array_filter(array_merge($themes['all'], $themes['broken']), array($this, '_search_callback')); } $totals = array(); foreach ($themes as $type => $list) { $totals[$type] = count($list); } if (empty($themes[$status]) && !in_array($status, array('all', 'search'))) { $status = 'all'; } $this->items = $themes[$status]; WP_Theme::sort_by_name($this->items); $this->has_items = !empty($themes['all']); $total_this_page = $totals[$status]; wp_localize_script('updates', '_wpUpdatesItemCounts', array('themes' => $totals, 'totals' => wp_get_update_data())); if ($orderby) { $orderby = ucfirst($orderby); $order = strtoupper($order); if ($orderby === 'Name') { if ('ASC' === $order) { $this->items = array_reverse($this->items); } } else { uasort($this->items, array($this, '_order_callback')); } } $start = ($page - 1) * $themes_per_page; if ($total_this_page > $themes_per_page) { $this->items = array_slice($this->items, $start, $themes_per_page, true); } $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page)); }
/** * Data callback for Themes * * @param string $name The name of the field * @param string|array $value The value of the field * @param array $options Field options * @param array $pod Pod data * @param int $id Item ID * * @return array * * @since 2.3 */ public function data_themes($name = null, $value = null, $options = null, $pod = null, $id = null) { $data = array(); $themes = wp_get_themes(array('allowed' => true)); foreach ($themes as $theme) { $data[$theme->Template] = $theme->Name; } return apply_filters('pods_form_ui_field_pick_' . __FUNCTION__, $data, $name, $value, $options, $pod, $id); }
/** * The html for the actual bar * * @package jptb * @since 0.0.1 */ function html_bar() { //put site's url in a var. $siteurl = get_bloginfo('url'); //get an array of themes. $themes = wp_get_themes(array('allowed' => true)); //get the label text. $options = $this->options(); $barLabel = $options['label']; //start bar. echo "<div id=\"jptb-theme-bar\">"; echo "<ul>"; //the label echo "<li>"; echo "<p id='jptb_label'>" . $barLabel . "</p>"; echo "</li>"; //output each theme foreach ($themes as $theme) { //construct info about theme we need. $themename = $theme['Name']; $noSpaceName = strtr($themename, " -", "__"); $nocapsname = strtolower($noSpaceName); $link = $siteurl . "/?theme=" . $theme->stylesheet; //Determin if theme is to be included. $uniqueOptionName = "jptb_" . $nocapsname; $jptb_option_value = get_option($uniqueOptionName); //create the switch for each one $switch = "<a href=\"{$link}\">{$themename}</a>"; if ($jptb_option_value == '1') { echo "<li>"; echo $switch; echo "</li>"; } } /* * Append something to the theme list. * * Be sure to wrap it in <li></li>! * * @package jptb * @since 0.0.3 */ do_action('jptb_end_of_the_list'); //end the list echo "</ul>"; /* * Append something to end of bar. * * Be sure to style the container for this! * * @package jptb * @since 0.0.3 */ do_action('jptb_end_of_the_bar'); //end the bar echo "</div> <!-- END #jptb-theme-bar -->"; }
public function wp_oracle_get_themes() { $themes_objects = wp_get_themes(); $themes = array(); foreach ($themes_objects as $slug => $theme) { array_push($themes, array('slug' => $slug, 'name' => $theme->get('Name'), 'version' => $theme->get('Version'))); } return array('blog' => array('themes' => $themes)); }
/** * @return mixed */ static function getStat() { $themes = wp_get_themes(); $themes_list = array(); foreach ($themes as $theme_shortname => $theme) { array_push($themes_list, array('name' => $theme['Name'], 'version' => $theme['Version'], 'theme' => $theme_shortname, 'updates' => self::checkUpdates($theme_shortname))); } return $themes_list; }
public function prepare_items() { global $totals, $status; $order = 'DESC'; $page = isset($_GET['paged']) ? absint($_GET['paged']) : 1; $orderby = 'Name'; $themes = array('all' => apply_filters('all_themes', wp_get_themes()), 'update_enabled' => array(), 'update_disabled' => array(), 'automatic' => array()); $maybe_update = current_user_can('update_themes') && !$this->is_site_themes && ($current = get_site_transient('update_themes')); $theme_options = MPSUM_Updates_Manager::get_options('themes'); $theme_automatic_options = MPSUM_Updates_Manager::get_options('themes_automatic'); foreach ((array) $themes['all'] as $theme => $theme_data) { if (false !== ($key = array_search($theme, $theme_options))) { $themes['update_disabled'][$theme] = $theme_data; } else { $themes['update_enabled'][$theme] = $theme_data; if (in_array($theme, $theme_automatic_options)) { $themes['automatic'][$theme] = $theme_data; } } } $totals = array(); foreach ($themes as $type => $list) { $totals[$type] = count($list); } //Disable the automatic updates view $core_options = MPSUM_Updates_Manager::get_options('core'); if (isset($core_options['automatic_theme_updates']) && 'individual' !== $core_options['automatic_theme_updates']) { unset($totals['automatic']); $themes['automatic'] = array(); } if (empty($themes[$status])) { $status = 'all'; } $this->items = $themes[$status]; WP_Theme::sort_by_name($this->items); $this->has_items = !empty($themes['all']); $total_this_page = $totals[$status]; if ($orderby) { $orderby = ucfirst($orderby); $order = strtoupper($order); if ($orderby == 'Name') { if ('ASC' == $order) { $this->items = array_reverse($this->items); } } else { uasort($this->items, array($this, '_order_callback')); } } $total_this_page = count($themes['all']); $themes_per_page = 999; $start = ($page - 1) * $themes_per_page; if ($total_this_page > $themes_per_page) { $this->items = array_slice($this->items, $start, $themes_per_page, true); } $this->set_pagination_args(array('total_items' => $total_this_page, 'per_page' => $themes_per_page)); }
/** * Get a core theme that is not the same as the current theme. * * @throws Exception If an inactive core Twenty* theme cannot be found. * @return string Theme slug (stylesheet). */ function get_inactive_core_theme() { $stylesheet = get_stylesheet(); foreach (wp_get_themes() as $theme) { if ($theme->stylesheet !== $stylesheet && 0 === strpos($theme->stylesheet, 'twenty')) { return $theme->stylesheet; } } throw new Exception('Unable to find inactive twenty* theme.'); }
/** * @param string $themeId E.g. "twentyfourteen" * @param string $action One of the supported actions, see this class's docs * @param string $themeName If not provided, found automatically based on $themeId */ public function __construct($themeId, $action, $themeName = null) { $this->themeId = $themeId; $this->action = $action; if ($themeName == null) { $themes = wp_get_themes(); $themeName = $themes[$themeId]->name; } $this->themeName = $themeName; }
function ultimatum_mobile_assigner(){ global $wpdb; if($_POST){ $table = $wpdb->prefix.ULTIMATUM_PREFIX.'_mobile'; $sql2 = "UPDATE $table SET `theme`='$_POST[theme]' , `mpush`='$_POST[mpush]' WHERE id='$_REQUEST[device]'"; $wpdb->query($sql2); _e('Settings Saved','ultimatum'); } ?> <h3><?php _e('Mobile Web Apps per Device', 'ultimatum');?></h3> <table class="widefat"> <?php $mtable = $wpdb->prefix.ULTIMATUM_PREFIX.'_mobile'; $sql = "SELECT * FROM `$mtable` "; $mres = $wpdb->get_results($sql,ARRAY_A); $result = wp_get_themes(); foreach( $mres as $device){ ?> <tr><th><?php echo $device['device']; ?></th> <?php echo '<td>'; echo '<form action"" method="post"><select name="theme">'; echo '<option value="0">'.__('Select','ultimatum').'</option>'; foreach( $result as $theme){ if($theme->template=='ultimatum'): if($device['theme']==$theme->stylesheet){ echo '<option value="'.$theme->stylesheet.'" selected="selected">'.$theme->name.'</option>'; } else { echo '<option value="'.$theme->stylesheet.'">'.$theme->name.'</option>'; } endif; } echo '</select><select name="mpush">'; echo '<option value="0" '; if($device['mpush']==0){echo 'selected="selected"';} echo '>'.__('Do NOT force Mobile apps', 'ultimatum').'</option>'; echo '<option value="1"'; if($device['mpush']==1){echo 'selected="selected"';} echo '>'.__('FORCE Mobile apps', 'ultimatum').'</option>'; echo ' </select> <input type="hidden" name="device" value="'.$device['id'].'" /> <input type="submit" value="Save" class="button-primary" /> </form></td></tr>'; } ?> </table> <?php }
public function testImport() { global $testHelpers, $installHelper; // in this test, appsettings doesn't contain any settings for wp-bootstrap // wp-cfm is not installed and there are no posts or menus exported $testHelpers->deleteWpInstallation(); $testHelpers->removeSettings(); $testHelpers->deleteState(); $installHelper->createDefaultInstall('ImportTests'); $testHelpers->copyState(__DIR__ . '/fixtures/importtest1'); exec('wp bootstrap setup'); $this->runImport(); // is the page there? $pages = get_posts(array('name' => 'sample-page', 'post_type' => 'page')); $this->assertTrue(count($pages) == 1); $page = $pages[0]; $this->assertEquals('Sample Page_IMPORTED', $page->post_title); // is the blog name correct? $this->assertEquals('ImportTests', get_bloginfo()); // make sure we can ask WP for list of plugins require_once ABSPATH . '/wp-admin/includes/plugin.php'; // is the wp-cfm plugin installed as expected? $plugins = get_plugins(); $this->assertTrue(isset($plugins['wp-cfm/wp-cfm.php'])); $this->assertTrue(isset($plugins['disable-comments/disable-comments.php'])); $this->assertEquals('1.3', $plugins['disable-comments/disable-comments.php']['Version']); // did the taxonomies work? $currentTerms = get_terms('category', array('hide_empty' => false)); usort($currentTerms, array($this, 'parentcmp')); $term = $currentTerms[0]; $this->assertEquals('Uncategorize2', $term->name); $this->assertEquals('uncategorized', $term->slug); $this->assertEquals('category', $term->taxonomy); $this->assertEquals(0, $term->parent); $term = $currentTerms[1]; $this->assertEquals('child', $term->name); $this->assertEquals('child', $term->slug); $this->assertEquals('category', $term->taxonomy); $this->assertEquals(1, $term->parent); // do we have the menus? $menuItems = wp_get_nav_menu_items('main'); $this->assertEquals(2, count($menuItems)); $item = $menuItems[0]; $this->assertEquals('post_type', $item->type); $this->assertEquals(1, $item->menu_order); $this->assertEquals('Page', $item->type_label); $this->assertEquals('Sample Page_IMPORTED', $item->title); $item = $menuItems[1]; $this->assertEquals('taxonomy', $item->type); $this->assertEquals(2, $item->menu_order); $this->assertEquals('Category', $item->type_label); $this->assertEquals('Uncategorize2', $item->title); $themes = wp_get_themes(); $this->assertEquals('1.0.7', $themes['griffin']->Version); }
/** * Add option to the network settings * * @author Julien Maury * @return bool */ static function network_admin_option() { if (!current_user_can('manage_network')) { return false; } $themes = wp_get_themes(array('allowed' => true)); $default_theme = get_site_option('default_network_theme'); if (empty($themes) || !is_array($themes)) { return false; } ?> <h3><?php _e('Theme settings', 'ms-dt'); ?> </h3> <table id="menu" class="form-table"> <tbody> <tr> <th scope="row"><?php _e('Theme by default', 'ms-dt'); ?> </th> <td> <select name="default_network_theme" id="default-network-theme"> <?php foreach ($themes as $theme) { ?> <option value="<?php esc_attr_e($theme->template); ?> " <?php selected(esc_attr($theme->template), $default_theme); ?> ><?php esc_html_e($theme->name); ?> </option> ; <?php } ?> </select> </td> </tr> </tbody> </table> <a href="<?php echo esc_url(network_admin_url('themes.php')); ?> "><?php _e('See themes available', 'ms-dt'); ?> </a> <?php }
function cancel_theme_updates() { global $wp_version; $theme_files = array(); if (count(wp_get_themes()) > 0) { foreach (wp_get_themes() as $theme) { $theme_files[$theme->get_stylesheet()] = $theme->get('Version'); } } return (object) array('last_checked' => time(), 'updates' => array(), 'version_checked' => $wp_version, 'checked' => $theme_files); }
function test_wp_get_theme() { $themes = wp_get_themes(); foreach ( $themes as $theme ) { $this->assertInstanceOf( 'WP_Theme', $theme ); $this->assertFalse( $theme->errors() ); $_theme = wp_get_theme( $theme->get_stylesheet() ); // This primes internal WP_Theme caches for the next assertion (headers_sanitized, textdomain_loaded) $this->assertEquals( $theme->get('Name'), $_theme->get('Name') ); $this->assertEquals( $theme, $_theme ); } }
function pl_get_themes() { if (!class_exists('WP_Theme')) { return get_themes(); } $themes = wp_get_themes(); foreach ($themes as $key => $theme) { $theme_data[$key] = array('Name' => $theme->get('Name'), 'URI' => $theme->display('ThemeURI', true, false), 'Description' => $theme->display('Description', true, false), 'Author' => $theme->display('Author', true, false), 'Author Name' => $theme->display('Author', false), 'Author URI' => $theme->display('AuthorURI', true, false), 'Version' => $theme->get('Version'), 'Template' => $theme->get('Template'), 'Status' => $theme->get('Status'), 'Tags' => $theme->get('Tags'), 'Title' => $theme->get('Name'), 'Template' => '' != $theme->display('Template', false, false) ? $theme->display('Template', false, false) : $key, 'Stylesheet' => $key, 'Stylesheet Files' => array(0 => sprintf('%s/style.css', $theme->get_stylesheet_directory()))); } return $theme_data; }
/** * Get Pronamic themes * * @return array */ function pronamic_client_get_themes() { $pronamic_themes = array(); $themes = wp_get_themes(); foreach ($themes as $slug => $theme) { if (isset($theme['Author']) && false !== strpos($theme['Author'], 'Pronamic')) { $pronamic_themes[$slug] = $theme; } } return $pronamic_themes; }
/** * Return translated context labels * * @return array Context label translations */ public static function get_context_labels() { $themes = wp_get_themes(); $themes_slugs = array_map(function ($theme) { return $theme->get_template(); }, $themes); $themes_names = array_map(function ($theme) { return (string) $theme; }, $themes); return array_combine($themes_slugs, $themes_names); }