public static function register_themes() { foreach (piklist::$paths as $type => $path) { if (is_dir($path . '/themes') && $type != 'theme') { register_theme_directory($path . '/themes'); } } }
function vhl_init() { if (is_admin()) { wp_enqueue_style('thickbox'); wp_enqueue_style('vhl-edit', BVS_PLUGIN_URL . 'css/styles.css'); wp_enqueue_script('thickbox'); wp_enqueue_script('vhl-edit', BVS_PLUGIN_URL . 'js/scripts.js'); } new VHL_PageLinksTo(); register_theme_directory(BVS_PLUGIN_PATH . '/bvs-themes'); }
/** * Register theme directories, set a filter that hides themes under certain conditions */ function registerThemeDirectories() { // No trailing slash, otherwise we get a double slash bug // @see \PressBooks\Metadata::fixDoubleSlashBug register_theme_directory(PB_PLUGIN_DIR . 'themes-root'); register_theme_directory(PB_PLUGIN_DIR . 'themes-book'); if (is_admin()) { if (Book::isBook()) { add_filter('allowed_themes', array($this, 'allowedBookThemes')); } else { add_filter('allowed_themes', array($this, 'allowedRootThemes')); } } }
function __construct($is_home, $page_id) { $this->_theme_root = untrailingslashit(PREMISE_THEMES_DIR); register_theme_directory($this->_theme_root); add_filter('template', array($this, 'theme_filter')); add_filter('stylesheet', array($this, 'theme_filter')); add_filter('theme_root', array($this, 'theme_root')); add_filter('stylesheet_directory_uri', array($this, 'stylesheet_directory_uri')); add_action('after_setup_theme', array($this, 'remove_init_hooks'), 999); add_filter('template_include', array($this, 'template_include')); define('BP_DISABLE_ADMIN_BAR', true); if ($is_home) { $this->_original_front_page = $page_id; remove_action('template_redirect', 'redirect_canonical'); add_action('parse_request', array(&$this, 'parse_request')); } add_action('parse_request', array(&$this, 'process_mailing_list_submissions')); }
/** * Register theme directories, set a filter that hides themes under certain conditions */ function registerThemeDirectories() { // No trailing slash, otherwise we get a double slash bug // @see \Pressbooks\Metadata::fixDoubleSlashBug register_theme_directory(PB_PLUGIN_DIR . 'themes-root'); register_theme_directory(PB_PLUGIN_DIR . 'themes-book'); do_action('pressbooks_register_theme_directory'); // Check for local themes-root directory if (realpath(WP_CONTENT_DIR . '/themes-root')) { register_theme_directory(WP_CONTENT_DIR . '/themes-root'); } if (is_admin()) { if (Book::isBook()) { add_filter('allowed_themes', array($this, 'allowedBookThemes')); } elseif (!is_network_admin()) { add_filter('allowed_themes', array($this, 'allowedRootThemes')); } } }
/** * Init: * - 1.: Require project config. * - 2.: Disable public visibility, if not production environment * - 3.: Register theme directory */ public function init() { parent::init(); // 1 add_action('muplugins_loaded', function () { if (file_exists(self::CONFIG)) { require_once self::CONFIG; } }, 20); // 2 if (WP_ENV !== 'production' && !is_admin()) { add_action('pre_option_blog_public', '__return_zero'); } // 3 if (!defined('WP_DEFAULT_THEME')) { $theme_dir = WP_CONTENT_DIR . '/themes'; register_theme_directory($theme_dir); } }
require_once $config_file_path; require_once dirname(__FILE__) . '/functions.php'; // Set the theme to our special empty theme, to avoid interference from the current Twenty* theme. if (!defined('WP_DEFAULT_THEME')) { define('WP_DEFAULT_THEME', 'default'); } tests_reset__SERVER(); $PHP_SELF = $GLOBALS['PHP_SELF'] = $_SERVER['PHP_SELF'] = '/index.php'; require_once ABSPATH . '/wp-settings.php'; require_once ABSPATH . '/wp-admin/includes/upgrade.php'; require_once ABSPATH . '/wp-includes/wp-db.php'; // Override the PHPMailer global $phpmailer; require_once dirname(__FILE__) . '/mock-mailer.php'; $phpmailer = new MockPHPMailer(); register_theme_directory(dirname(__FILE__) . '/../data/themedir1'); /* * default_storage_engine and storage_engine are the same option, but storage_engine * was deprecated in MySQL (and MariaDB) 5.5.3, and removed in 5.7. */ if (version_compare($wpdb->db_version(), '5.5.3', '>=')) { $wpdb->query('SET default_storage_engine = InnoDB'); } else { $wpdb->query('SET storage_engine = InnoDB'); } $wpdb->select(DB_NAME, $wpdb->dbh); echo "Installing..." . PHP_EOL; $wpdb->query("SET foreign_key_checks = 0"); foreach ($wpdb->tables() as $table => $prefixed_table) { $wpdb->query("DROP TABLE IF EXISTS {$prefixed_table}"); }
/** * @ticket 28662 */ function test_theme_dir_slashes() { $size = count($GLOBALS['wp_theme_directories']); @mkdir(WP_CONTENT_DIR . '/themes/foo'); @mkdir(WP_CONTENT_DIR . '/themes/foo-themes'); $this->assertTrue(file_exists(WP_CONTENT_DIR . '/themes/foo')); $this->assertTrue(file_exists(WP_CONTENT_DIR . '/themes/foo-themes')); register_theme_directory('/'); $this->assertCount($size, $GLOBALS['wp_theme_directories']); register_theme_directory('themes/'); $this->assertCount($size, $GLOBALS['wp_theme_directories']); register_theme_directory('/foo/'); $this->assertCount($size, $GLOBALS['wp_theme_directories']); register_theme_directory('foo/'); $this->assertCount($size, $GLOBALS['wp_theme_directories']); register_theme_directory('themes/foo/'); $this->assertCount($size + 1, $GLOBALS['wp_theme_directories']); register_theme_directory(WP_CONTENT_DIR . '/foo-themes/'); $this->assertCount($size + 1, $GLOBALS['wp_theme_directories']); foreach ($GLOBALS['wp_theme_directories'] as $dir) { $this->assertNotEquals('/', substr($dir, -1)); } rmdir(WP_CONTENT_DIR . '/themes/foo'); rmdir(WP_CONTENT_DIR . '/themes/foo-themes'); }
} define('BP_ROOT_BLOG', $root_blog_id); } // Path and URL if (!defined('BP_PLUGIN_DIR')) { define('BP_PLUGIN_DIR', nxt_PLUGIN_DIR . '/buddypress'); } if (!defined('BP_PLUGIN_URL')) { define('BP_PLUGIN_URL', plugins_url('buddypress')); } // The search slug has to be defined nice and early because of the way search requests are loaded if (!defined('BP_SEARCH_SLUG')) { define('BP_SEARCH_SLUG', 'search'); } // Setup the BuddyPress theme directory register_theme_directory(BP_PLUGIN_DIR . '/bp-themes'); /** Loader ********************************************************************/ // Load the nxt abstraction file so BuddyPress can run on all NXTClass setups. require BP_PLUGIN_DIR . '/bp-core/bp-core-nxtabstraction.php'; // Test to see whether this is a new installation or an upgraded version of BuddyPress if (!($bp->database_version = get_site_option('bp-db-version'))) { if ($bp->database_version = get_option('bp-db-version')) { $bp->is_network_activate = 1; } else { $bp->database_version = get_site_option('bp-core-db-version'); // BP 1.2 option } } // This is a new installation. if (empty($bp->database_version)) { $bp->maintenance_mode = 'install';
define("DIGRESSIT_CORE_CSS_DIR", DIGRESSIT_CORE_DIR . '/css'); define("DIGRESSIT_THEMES_DIR", DIGRESSIT_DIR . '/themes'); define("DIGRESSIT_URL", WP_PLUGIN_URL . "/" . $plugin_name); define("DIGRESSIT_CORE_URL", DIGRESSIT_URL . '/core'); define("DIGRESSIT_CORE_JS_URL", DIGRESSIT_CORE_URL . '/js'); define("DIGRESSIT_CORE_IMG_URL", DIGRESSIT_CORE_URL . '/images'); define("DIGRESSIT_CORE_CSS_URL", DIGRESSIT_CORE_URL . '/css'); define("DIGRESSIT_THEMES_URL", DIGRESSIT_URL . '/themes'); //load core files digressit_auto_load_dir(DIGRESSIT_CORE_DIR); digressit_auto_load_dir(DIGRESSIT_EXTENSIONS_DIR); $browser = digressit_current_browser(); /* activation and deactivation */ register_activation_hook(__FILE__, 'activate_digressit'); register_deactivation_hook(__FILE__, 'deactivate_digressit'); register_theme_directory($plugin_theme_link); register_digressit_content_function('standard_digressit_content_parser'); register_digressit_content_function('discrete_digressit_content_parser'); register_digressit_comments_function('standard_digressit_comment_parser'); register_digressit_commentbox_js('grouping_digressit_commentbox_parser'); register_digressit_commentbox_js('nogrouping_digressit_commentbox_parser'); add_action('init', 'digressit_init'); add_action('init', 'create_digressit_post_type'); add_action('after_setup_theme', 'digressit_setup'); /* admin functions */ add_action('admin_head-post.php', 'digressit_add_comment_change_notice'); add_action('admin_head-edit.php', 'digressit_custom_type_notice'); add_action('admin_menu', 'digressit_add_admin_menu'); add_action('admin_init', 'digressit_theme_options_page_form'); /* ajax init functions */ add_filter('query_vars', 'ajax_query_vars', 0);
/** * Register the directory containing the plugin's specific themes. * * @since 0.1 */ public function register_directory() { register_theme_directory(plugin_dir_path(dirname(__FILE__)) . 'themes'); }
/** * Retrieve list of themes with theme data in theme directory. * * The theme is broken, if it doesn't have a parent theme and is missing either * style.css and, or index.php. If the theme has a parent theme then it is * broken, if it is missing style.css; index.php is optional. The broken theme * list is saved in the {@link $wp_broken_themes} global, which is displayed on * the theme list in the administration panels. * * @since 1.5.0 * @global array $wp_broken_themes Stores the broken themes. * @global array $wp_themes Stores the working themes. * * @return array Theme list with theme data. */ function get_themes() { global $wp_themes, $wp_broken_themes; if (isset($wp_themes)) { return $wp_themes; } /* Register the default root as a theme directory */ register_theme_directory(get_theme_root()); if (!($theme_files = search_theme_directories())) { return false; } asort($theme_files); $wp_themes = array(); foreach ((array) $theme_files as $theme_file) { $theme_root = $theme_file['theme_root']; $theme_file = $theme_file['theme_file']; if (!is_readable("{$theme_root}/{$theme_file}")) { $wp_broken_themes[$theme_file] = array('Name' => $theme_file, 'Title' => $theme_file, 'Description' => __('File not readable.')); continue; } $theme_data = get_theme_data("{$theme_root}/{$theme_file}"); $name = $theme_data['Name']; $title = $theme_data['Title']; $description = wptexturize($theme_data['Description']); $version = $theme_data['Version']; $author = $theme_data['Author']; $template = $theme_data['Template']; $stylesheet = dirname($theme_file); $screenshot = false; foreach (array('png', 'gif', 'jpg', 'jpeg') as $ext) { if (file_exists("{$theme_root}/{$stylesheet}/screenshot.{$ext}")) { $screenshot = "screenshot.{$ext}"; break; } } if (empty($name)) { $name = dirname($theme_file); $title = $name; } $parent_template = $template; if (empty($template)) { if (file_exists("{$theme_root}/{$stylesheet}/index.php")) { $template = $stylesheet; } else { continue; } } $template = trim($template); if (!file_exists("{$theme_root}/{$template}/index.php")) { $parent_dir = dirname(dirname($theme_file)); if (file_exists("{$theme_root}/{$parent_dir}/{$template}/index.php")) { $template = "{$parent_dir}/{$template}"; $template_directory = "{$theme_root}/{$template}"; } else { /** * The parent theme doesn't exist in the current theme's folder or sub folder * so lets use the theme root for the parent template. */ if (isset($theme_files[$template]) && file_exists($theme_files[$template]['theme_root'] . "/{$template}/index.php")) { $template_directory = $theme_files[$template]['theme_root'] . "/{$template}"; } else { if (empty($parent_template)) { $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => __('Template is missing.'), 'error' => 'no_template'); } else { $wp_broken_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => sprintf(__('The parent theme is missing. Please install the "%s" parent theme.'), $parent_template), 'error' => 'no_parent', 'parent' => $parent_template); } continue; } } } else { $template_directory = trim($theme_root . '/' . $template); } $stylesheet_files = array(); $template_files = array(); $stylesheet_dir = @dir("{$theme_root}/{$stylesheet}"); if ($stylesheet_dir) { while (($file = $stylesheet_dir->read()) !== false) { if (!preg_match('|^\\.+$|', $file)) { if (preg_match('|\\.css$|', $file)) { $stylesheet_files[] = "{$theme_root}/{$stylesheet}/{$file}"; } elseif (preg_match('|\\.php$|', $file)) { $template_files[] = "{$theme_root}/{$stylesheet}/{$file}"; } } } @$stylesheet_dir->close(); } $template_dir = @dir("{$template_directory}"); if ($template_dir) { while (($file = $template_dir->read()) !== false) { if (preg_match('|^\\.+$|', $file)) { continue; } if (preg_match('|\\.php$|', $file)) { $template_files[] = "{$template_directory}/{$file}"; } elseif (is_dir("{$template_directory}/{$file}")) { $template_subdir = @dir("{$template_directory}/{$file}"); if (!$template_subdir) { continue; } while (($subfile = $template_subdir->read()) !== false) { if (preg_match('|^\\.+$|', $subfile)) { continue; } if (preg_match('|\\.php$|', $subfile)) { $template_files[] = "{$template_directory}/{$file}/{$subfile}"; } } @$template_subdir->close(); } } @$template_dir->close(); } //Make unique and remove duplicates when stylesheet and template are the same i.e. most themes $template_files = array_unique($template_files); $stylesheet_files = array_unique($stylesheet_files); $template_dir = dirname($template_files[0]); $stylesheet_dir = dirname($stylesheet_files[0]); if (empty($template_dir)) { $template_dir = '/'; } if (empty($stylesheet_dir)) { $stylesheet_dir = '/'; } // Check for theme name collision. This occurs if a theme is copied to // a new theme directory and the theme header is not updated. Whichever // theme is first keeps the name. Subsequent themes get a suffix applied. // The Default and Classic themes always trump their pretenders. if (isset($wp_themes[$name])) { if (('WordPress Default' == $name || 'WordPress Classic' == $name) && ('default' == $stylesheet || 'classic' == $stylesheet)) { // If another theme has claimed to be one of our default themes, move // them aside. $suffix = $wp_themes[$name]['Stylesheet']; $new_name = "{$name}/{$suffix}"; $wp_themes[$new_name] = $wp_themes[$name]; $wp_themes[$new_name]['Name'] = $new_name; } else { $name = "{$name}/{$stylesheet}"; } } $theme_roots[$stylesheet] = str_replace(WP_CONTENT_DIR, '', $theme_root); $wp_themes[$name] = array('Name' => $name, 'Title' => $title, 'Description' => $description, 'Author' => $author, 'Author Name' => $theme_data['AuthorName'], 'Author URI' => $theme_data['AuthorURI'], 'Version' => $version, 'Template' => $template, 'Stylesheet' => $stylesheet, 'Template Files' => $template_files, 'Stylesheet Files' => $stylesheet_files, 'Template Dir' => $template_dir, 'Stylesheet Dir' => $stylesheet_dir, 'Status' => $theme_data['Status'], 'Screenshot' => $screenshot, 'Tags' => $theme_data['Tags'], 'Theme Root' => $theme_root, 'Theme Root URI' => str_replace(WP_CONTENT_DIR, content_url(), $theme_root)); } unset($theme_files); /* Store theme roots in the DB */ if (get_site_transient('theme_roots') != $theme_roots) { set_site_transient('theme_roots', $theme_roots, 7200); } // cache for two hours unset($theme_roots); /* Resolve theme dependencies. */ $theme_names = array_keys($wp_themes); foreach ((array) $theme_names as $theme_name) { $wp_themes[$theme_name]['Parent Theme'] = ''; if ($wp_themes[$theme_name]['Stylesheet'] != $wp_themes[$theme_name]['Template']) { foreach ((array) $theme_names as $parent_theme_name) { if ($wp_themes[$parent_theme_name]['Stylesheet'] == $wp_themes[$parent_theme_name]['Template'] && $wp_themes[$parent_theme_name]['Template'] == $wp_themes[$theme_name]['Template']) { $wp_themes[$theme_name]['Parent Theme'] = $wp_themes[$parent_theme_name]['Name']; break; } } } } return $wp_themes; }
/** * Set up BuddyPress's legacy theme directory. * * Starting with version 1.2, and ending with version 1.8, BuddyPress * registered a custom theme directory - bp-themes - which contained * the bp-default theme. Since BuddyPress 1.9, bp-themes is no longer * registered (and bp-default no longer offered) on new installations. * Sites using bp-default (or a child theme of bp-default) will * continue to have bp-themes registered as before. * * @since 1.5.0 * * @todo Move bp-default to wordpress.org/extend/themes and remove this. */ public function register_theme_directory() { if (!bp_do_register_theme_directory()) { return; } register_theme_directory($this->old_themes_dir); }
/** * Setup the default hooks and actions * * @since BuddyPress (1.6) * @access private * * @uses register_activation_hook() To register the activation hook * @uses register_deactivation_hook() To register the deactivation hook * @uses add_action() To add various actions */ private function setup_actions() { // Add actions to plugin activation and deactivation hooks add_action('activate_' . $this->basename, 'bp_activation'); add_action('deactivate_' . $this->basename, 'bp_deactivation'); // If BuddyPress is being deactivated, do not add any actions if (bp_is_deactivation($this->basename)) { return; } // Array of BuddyPress core actions $actions = array('setup_current_user', 'register_post_types', 'register_post_statuses', 'register_taxonomies', 'register_views', 'register_theme_directory', 'load_textdomain', 'add_rewrite_tags', 'generate_rewrite_rules'); // Add the actions foreach ($actions as $class_action) { add_action('bp_' . $class_action, array($this, $class_action), 5); } // Setup the BuddyPress theme directory register_theme_directory($this->themes_dir); }
/** * @package Hello_Dolly * @version 1.6 */ /* Plugin Name: INIT Plugin URI: Description: System Init Author: Mo Version: 1.1 Author URI: http://mo.sh/ */ register_theme_directory(__DIR__); foreach (Module::all() as $name => $module) { if (Module::find($name)->json()->type == 'theme') { register_theme_directory(dirname($module->getpath())); //kd($module->getpath()); } } //add_filter('theme_root',function($theme_root){ // return __DIR__; //}); //add_filter('theme_root_uri',function($theme_root_uri = '', $siteurl = '', $stylesheet_or_template = ''){ // kd($theme_root_uri, $siteurl, $stylesheet_or_template); // return content_url(); //}); show_admin_bar(false); // 上传图片时把绝对地址修改成相对地址(禁用,导致上传文件http错误) //add_filter('wp_handle_upload', function ($fileInfos){ // global $blog_id; // $path = get_blog_option($blog_id, 'siteurl');
# Enable all core updates, including minor and major (true, false, minor) //define( 'WP_AUTO_UPDATE_CORE', true ); # File Editing //define( 'DISALLOW_FILE_MODS', FALSE ); //define( 'DISALLOW_FILE_EDIT', FALSE ); //define( 'FS_CHMOD_DIR', 0755 ); //define( 'FS_CHMOD_FILE', 0644 ); //define( 'FS_METHOD', 'direct' ); //define('FS_METHOD', 'ftpext'); // forces the filesystem method: "direct", "ssh", "ftpext", or "ftpsockets" //define('FTP_BASE', '/path/to/wordpress/'); // absolute path to root installation directory //define('FTP_CONTENT_DIR', '/path/to/wordpress/wp-content/'); // absolute path to "wp-content" directory //define('FTP_PLUGIN_DIR ', '/path/to/wordpress/wp-content/plugins/'); // absolute path to "wp-plugins" directory //define('FTP_PUBKEY', '/home/username/.ssh/id_rsa.pub'); // absolute path to your SSH public key //define('FTP_PRIVKEY', '/home/username/.ssh/id_rsa'); // absolute path to your SSH private key //define('FTP_USER', 'username'); // either your FTP or SSH username //define('FTP_PASS', 'password'); // password for FTP_USER username //define('FTP_HOST', 'ftp.domain.tld:21'); // hostname:port combo for your SSH/FTP server # Plugins // define('UBERMENU_AUTO_UPDATES', 1); // Auto Update Ubermenu // define('CODE_SNIPPETS_SAFE_MODE', true); // Safe Mode Condesnippets // define('ACF_5_KEY',''); // ACF License Key /** Absolute path to the WordPress directory. */ if (!defined('ABSPATH')) { define('ABSPATH', dirname(__FILE__) . '/'); } /** Sets up WordPress vars and included files. */ require_once ABSPATH . 'wp-settings.php'; // register_theme_directory( dirname( __FILE__ ) . '/assets' ); if (!defined('WP_THEME_DIR')) { register_theme_directory(CUSTOM_THEME_DIR); }
public function register_theme_directory() { global $wp_theme_directories; // Allow registration of other theme directories or moving the CoursePress theme. $theme_directories = apply_filters('bs_theme_directory_array', array($this->get_plugin_path() . 'themes', ABSPATH . 'wp-content/themes')); //diebug($this->get_plugin_path()); foreach ($theme_directories as $theme_directory) { register_theme_directory($theme_directory); } }
<?php // Child theme (do not remove) define('CHILD_THEME_NAME', 'thesimplekind'); define('CHILD_THEME_URL', 'http://www.johnpotessdesign.com/'); define('CHILD_THEME_VERSION', '0.1.0'); //* Enqueue scripts and styles add_action('wp_enqueue_scripts', 'gs_scripts_and_styles', 15); function gs_scripts_and_styles() { // Styles wp_enqueue_style('site-styles', get_stylesheet_directory_uri() . '/app/css/styles.min.css', array(), CHILD_THEME_VERSION); wp_enqueue_style('font-awesome', '//maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css', array(), CHILD_THEME_VERSION); // Scripts wp_enqueue_script('jquery'); wp_enqueue_script('site-scripts', get_stylesheet_directory_uri() . '/app/js/scripts.min.js', array('jquery'), '', true); } register_theme_directory(dirname(__FILE__) . '/app/');
/** * Setup the BuddyPress theme directory * * @since BuddyPress (1.5) * @todo Move bp-default to wordpress.org/extend/themes and remove this */ public function register_theme_directory() { register_theme_directory($this->old_themes_dir); }
<?php /* Plugin Name: Theme Mover Plugin URI: https://github.com/Softcatala/wp-theme-mover Description: Provides an additional location for themes Version: 0.0.1 Author: Pau Iranzo Author URI: http://www.softcatala.org */ register_theme_directory(ABSPATH . '../themes');
* @since 0.8.0 */ function kirki_load_textdomain() { $textdomain = 'kirki'; // Look for WP_LANG_DIR/{$domain}-{$locale}.mo if (file_exists(WP_LANG_DIR . '/' . $textdomain . '-' . get_locale() . '.mo')) { $file = WP_LANG_DIR . '/' . $textdomain . '-' . get_locale() . '.mo'; } // Look for Kirki::$path/languages/{$domain}-{$locale}.mo if (!isset($file) && file_exists(Kirki::$path . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR . $textdomain . '-' . get_locale() . '.mo')) { $file = Kirki::$path . DIRECTORY_SEPARATOR . 'languages' . DIRECTORY_SEPARATOR . $textdomain . '-' . get_locale() . '.mo'; } if (isset($file)) { load_textdomain($textdomain, $file); } load_plugin_textdomain($textdomain, false, Kirki::$path . DIRECTORY_SEPARATOR . 'languages'); } add_action('plugins_loaded', 'kirki_load_textdomain'); } // Add an empty config for global fields Kirki::add_config(''); /** * To enable the demo theme, just add this line to your wp-config.php file: * define( 'KIRKI_CONFIG', true ); * Once you add that line, you'll see a new theme in your dashboard called "Kirki Demo". * Activate that theme to test all controls. */ if (defined('KIRKI_DEMO') && KIRKI_DEMO && file_exists(dirname(__FILE__) . '/demo-theme/style.css')) { register_theme_directory(dirname(__FILE__)); }
/** * Install a theme. * * ## OPTIONS * * <theme|zip|url>... * : A theme slug, the path to a local zip file, or URL to a remote zip file. * * [--version=<version>] * : If set, get that particular version from wordpress.org, instead of the * stable version. * * [--force] * : If set, the command will overwrite any installed version of the theme, without prompting * for confirmation. * * [--activate] * : If set, the theme will be activated immediately after install. * * ## EXAMPLES * * # Install the latest version from wordpress.org and activate * wp theme install twentytwelve --activate * * # Install from a local zip file * wp theme install ../my-theme.zip * * # Install from a remote zip file * wp theme install http://s3.amazonaws.com/bucketname/my-theme.zip?AWSAccessKeyId=123&Expires=456&Signature=abcdef */ function install($args, $assoc_args) { $theme_root = get_theme_root(); if ($theme_root && !is_dir($theme_root)) { wp_mkdir_p($theme_root); register_theme_directory($theme_root); } parent::install($args, $assoc_args); }
/** * Register all scripts and styles * * @since 1.0.1 */ function pbtInit() { // Register theme directory register_theme_directory( PBT_PLUGIN_DIR . 'themes-book' ); // Add a rewrite rule for the keyword "open" add_rewrite_endpoint( 'open', EP_ROOT ); // Flush, if we haven't already \PBT\Rewrite\flusher(); }
function register_theme_directory() { global $wp_theme_directories; // Allow registration of other theme directories or moving the CoursePress theme. $theme_directories = apply_filters('coursepress_theme_directory_array', array($this->plugin_dir . 'themes/')); foreach ($theme_directories as $theme_directory) { register_theme_directory($theme_directory); } }
<?php /** * Plugin Name: Core Themes * Plugin URI: https://github.com/chrisguitarguy/wordpress-skeleton * Description: Registers the core themes directory. Since we use a custom content directory those are lost. * Version: 1.0 * Author: Christopher Davis * Author URI: http://christopherdavis.me * License: MIT * * @category WordPress * @copyright 2015 Christopher Davis * @license http://opensource.org/licenses/mit MIT */ !defined('ABSPATH') && exit; // https://codex.wordpress.org/Function_Reference/register_theme_directory register_theme_directory(ABSPATH . 'wp-content/themes');
<?php /* Plugin Name: Extra Theme Dir */ /** * Adds an additional, non gitignored theme directory */ register_theme_directory(trailingslashit(WP_CONTENT_DIR) . '/{%= site_slug %}-themes');
do_action('muplugins_loaded'); if (is_multisite()) { ms_cookie_constants(); } // Define constants after multisite is loaded. Cookie-related constants may be overridden in ms_network_cookies(). wp_cookie_constants(); // Define and enforce our SSL constants wp_ssl_constants(); // Create common globals. require ABSPATH . WPINC . '/vars.php'; // Make taxonomies and posts available to plugins and themes. // @plugin authors: warning: these get registered again on the init hook. create_initial_taxonomies(); create_initial_post_types(); // Register the default theme directory root register_theme_directory(get_theme_root()); // Load active plugins. foreach (wp_get_active_and_valid_plugins() as $plugin) { include_once $plugin; } unset($plugin); // Load pluggable functions. require ABSPATH . WPINC . '/pluggable.php'; require ABSPATH . WPINC . '/pluggable-deprecated.php'; // Set internal encoding. wp_set_internal_encoding(); // Run wp_cache_postload() if object cache is enabled and the function exists. if (WP_CACHE && function_exists('wp_cache_postload')) { wp_cache_postload(); } do_action('plugins_loaded');
public function requireTheme() { if (!empty($this->context['wp_theme_directories'])) { return; } register_theme_directory(get_theme_root()); }
function register_theme() { register_theme_directory(__DIR__ . '/themes'); wp_register_style('candela', __DIR__ . '/themes/candela/style.css', array('pressbooks'), VERSION, 'screen'); wp_register_style('candela-clean', __DIR__ . '/themes/candela-clean/style.css', array('pressbooks'), VERSION, 'screen'); }
/** * Because register_theme_directory() can't run on init. * * @return void */ public function setup_theme() { /* how in the blue fuckity did this even work? original path was: 'plugins/' . MP_FOLDER . '/themes' */ register_theme_directory(WP_PLUGIN_DIR . '/' . MP_FOLDER . '/themes'); }