Version Description
- Remove /downgrade/ directory in case it caused the reported PCLZIP_ERR_BAD_FORMAT errors
Download this release
Release Info
Developer | dgewirtz |
Plugin | Multiple Themes |
Version | 5.0.2 |
Comparing to | |
See all releases |
Version 5.0.2
- includes/admin-functions.php +164 -0
- includes/admin.php +1715 -0
- includes/functions.php +450 -0
- includes/index.html +0 -0
- includes/old-wp.php +20 -0
- includes/select-theme.php +478 -0
- includes/settings-cleanup.php +68 -0
- includes/upgradev5.php +127 -0
- index.html +0 -0
- jonradio-multiple-themes.php +193 -0
- js/index.html +0 -0
- js/sticky.js +135 -0
- js/tabs.js +21 -0
- readme.txt +397 -0
- uninstall.php +27 -0
includes/admin-functions.php
ADDED
@@ -0,0 +1,164 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
<?php
|
2 |
+
|
3 |
+
/* Exit if .php file accessed directly
|
4 |
+
*/
|
5 |
+
if ( !defined( 'ABSPATH' ) ) {
|
6 |
+
exit;
|
7 |
+
}
|
8 |
+
|
9 |
+
function jr_mt_theme_entry( $type, $theme = '', $display1 = NULL, $display2 = NULL ) {
|
10 |
+
$three_dots = '…';
|
11 |
+
$before = '<li>Delete <input type="checkbox" id="del_entry" name="jr_mt_settings[del_entry][]" value="';
|
12 |
+
$after = '" /> ';
|
13 |
+
$theme_equals = 'Theme=' . wp_get_theme( $theme )->Name . '; ';
|
14 |
+
switch ( $type ) {
|
15 |
+
case 'Query':
|
16 |
+
echo $before
|
17 |
+
. 'query'
|
18 |
+
. '='
|
19 |
+
. $display1
|
20 |
+
. '='
|
21 |
+
. $display2
|
22 |
+
. $after
|
23 |
+
. $theme_equals;
|
24 |
+
if ( '*' !== $display2 ) {
|
25 |
+
$settings = get_option( 'jr_mt_settings' );
|
26 |
+
$sticky = isset( $settings['remember']['query'][ $display1 ][ $display2 ] );
|
27 |
+
$override = isset( $settings['override']['query'][ $display1 ][ $display2 ] );
|
28 |
+
if ( $sticky ) {
|
29 |
+
if ( $override ) {
|
30 |
+
echo 'Sticky/Override ';
|
31 |
+
} else {
|
32 |
+
echo 'Sticky ';
|
33 |
+
}
|
34 |
+
} else {
|
35 |
+
if ( $override ) {
|
36 |
+
echo 'Override ';
|
37 |
+
}
|
38 |
+
}
|
39 |
+
}
|
40 |
+
echo 'Query='
|
41 |
+
. '<code>'
|
42 |
+
. home_url()
|
43 |
+
. "/</code>$three_dots<code>/?"
|
44 |
+
. '<b><input type="text" readonly="readonly" disable="disabled" name="jr_mt_delkw" value="'
|
45 |
+
. $display1
|
46 |
+
. '" size="'
|
47 |
+
. jr_mt_strlen( $display1 )
|
48 |
+
. '" /></b>'
|
49 |
+
. '=';
|
50 |
+
if ( '*' === $display2 ) {
|
51 |
+
echo '</code>' . $three_dots;
|
52 |
+
} else {
|
53 |
+
echo '<b><input type="text" readonly="readonly" disable="disabled" name="jr_mt_delkwval" value="'
|
54 |
+
. $display2
|
55 |
+
. '" size="'
|
56 |
+
. jr_mt_strlen( $display2 )
|
57 |
+
. '" /></b></code>';
|
58 |
+
}
|
59 |
+
break;
|
60 |
+
case 'url':
|
61 |
+
case 'url_prefix':
|
62 |
+
case 'url_asterisk':
|
63 |
+
echo $before
|
64 |
+
. $type
|
65 |
+
. '='
|
66 |
+
. 'url'
|
67 |
+
. '='
|
68 |
+
. $display1
|
69 |
+
. $after
|
70 |
+
. $theme_equals
|
71 |
+
. $display2
|
72 |
+
. '=<code>' . $display1 . '</code>';
|
73 |
+
break;
|
74 |
+
case 'wordpress':
|
75 |
+
echo '<li><a href="'
|
76 |
+
. get_admin_url()
|
77 |
+
. 'themes.php" class="button-primary">Change</a> '
|
78 |
+
. 'Theme='
|
79 |
+
. wp_get_theme()->Name
|
80 |
+
. ', the Theme chosen as Active from Appearance-Themes in the WordPress Admin panels';
|
81 |
+
break;
|
82 |
+
default:
|
83 |
+
echo $before
|
84 |
+
. $type
|
85 |
+
. $after
|
86 |
+
. $theme_equals
|
87 |
+
. $display1;
|
88 |
+
if ( 'site_home' === $type ) {
|
89 |
+
echo ' (<code>' . home_url() . '</code>)';
|
90 |
+
}
|
91 |
+
echo ' setting (see Advanced Settings tab)';
|
92 |
+
break;
|
93 |
+
}
|
94 |
+
echo '</li>';
|
95 |
+
}
|
96 |
+
|
97 |
+
// $theme_name is the name of the Theme's folder within the Theme directory
|
98 |
+
function jr_mt_themes_field( $field_name, $theme_name, $setting, $excl_current_theme ) {
|
99 |
+
echo "<select id='$field_name' name='$setting" . "[$field_name]' size='1'>";
|
100 |
+
if ( empty( $theme_name ) ) {
|
101 |
+
$selected = 'selected="selected"';
|
102 |
+
} else {
|
103 |
+
$selected = '';
|
104 |
+
}
|
105 |
+
echo "<option value='' $selected></option>";
|
106 |
+
foreach ( jr_mt_all_themes() as $folder => $theme_obj ) {
|
107 |
+
if ( $excl_current_theme ) {
|
108 |
+
if ( ( jr_mt_current_theme( 'stylesheet' ) == $theme_obj['stylesheet'] ) && ( jr_mt_current_theme( 'template' ) == $theme_obj['template'] ) ) {
|
109 |
+
// Skip the Current Theme
|
110 |
+
continue;
|
111 |
+
}
|
112 |
+
}
|
113 |
+
if ( $theme_name === $folder ) {
|
114 |
+
$selected = 'selected="selected"';
|
115 |
+
} else {
|
116 |
+
$selected = '';
|
117 |
+
}
|
118 |
+
$name = $theme_obj->Name;
|
119 |
+
echo "<option value='$folder' $selected>$name</option>";
|
120 |
+
}
|
121 |
+
echo '</select>' . PHP_EOL;
|
122 |
+
}
|
123 |
+
|
124 |
+
/**
|
125 |
+
* Update available for Plugin?
|
126 |
+
*
|
127 |
+
* @return bool - TRUE if an update is available in the WordPress Repository,
|
128 |
+
* FALSE if no update is available or if the update_plugins transient is not available
|
129 |
+
* (which also results in an error message).
|
130 |
+
**/
|
131 |
+
function jr_mt_plugin_update_available() {
|
132 |
+
global $jr_mt_update_plugins;
|
133 |
+
if ( !isset( $jr_mt_update_plugins ) ) {
|
134 |
+
$transient = get_site_transient( 'update_plugins' );
|
135 |
+
if ( FALSE === $transient ) {
|
136 |
+
// Error
|
137 |
+
return FALSE;
|
138 |
+
} else {
|
139 |
+
$jr_mt_update_plugins = $transient;
|
140 |
+
}
|
141 |
+
}
|
142 |
+
if ( empty( $jr_mt_update_plugins->response ) ) {
|
143 |
+
return FALSE;
|
144 |
+
}
|
145 |
+
return array_key_exists( jr_mt_plugin_basename(), $jr_mt_update_plugins->response );
|
146 |
+
}
|
147 |
+
|
148 |
+
/**
|
149 |
+
* Prepare URL Query Value
|
150 |
+
*
|
151 |
+
* Sanitize and standardize a URL Query Value for storage in a database.
|
152 |
+
* Does not support ?keyword[]=value, i.e. - $value cannot be an Array.
|
153 |
+
*
|
154 |
+
* @param string $value URL Query Value to be sanitized and standardized; will fail if array
|
155 |
+
* @return string URL Query Value after being sanitized and standardized
|
156 |
+
*/
|
157 |
+
function jr_mt_prep_query_value( $value ) {
|
158 |
+
return str_ireplace( '%e2%80%8e', '', jr_mt_strtolower( trim( $value ) ) );
|
159 |
+
}
|
160 |
+
function jr_mt_prep_query_keyword( $keyword ) {
|
161 |
+
return jr_mt_prep_query_value( $keyword );
|
162 |
+
}
|
163 |
+
|
164 |
+
?>
|
includes/admin.php
ADDED
@@ -0,0 +1,1715 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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, for easy access
|
6 |
+
add_filter( 'plugin_action_links_' . jr_mt_plugin_basename(), 'jr_mt_plugin_action_links', 10, 1 );
|
7 |
+
|
8 |
+
/**
|
9 |
+
* Creates Settings entry right on the Plugins Page entry.
|
10 |
+
*
|
11 |
+
* Helps the user understand where to go immediately upon Activation of the Plugin
|
12 |
+
* by creating entries on the Plugins page, right beside Deactivate and Edit.
|
13 |
+
*
|
14 |
+
* @param array $links Existing links for our Plugin, supplied by WordPress
|
15 |
+
* @param string $file Name of Plugin currently being processed
|
16 |
+
* @return string $links Updated set of links for our Plugin
|
17 |
+
*/
|
18 |
+
function jr_mt_plugin_action_links( $links ) {
|
19 |
+
// The "page=" query string value must be equal to the slug
|
20 |
+
// of the Settings admin page.
|
21 |
+
array_push( $links, '<a href="' . get_bloginfo('wpurl') . '/wp-admin/admin.php?page=jr_mt_settings' . '">Settings</a>' );
|
22 |
+
return $links;
|
23 |
+
}
|
24 |
+
|
25 |
+
|
26 |
+
// Admin Page
|
27 |
+
|
28 |
+
add_action( 'admin_menu', 'jr_mt_admin_hook' );
|
29 |
+
// Runs just before admin_init (below)
|
30 |
+
|
31 |
+
/**
|
32 |
+
* Add Admin Menu item for plugin
|
33 |
+
*
|
34 |
+
* Plugin needs its own Page in the Settings section of the Admin menu.
|
35 |
+
*
|
36 |
+
*/
|
37 |
+
function jr_mt_admin_hook() {
|
38 |
+
// Add Settings Page for this Plugin
|
39 |
+
global $jr_mt_plugin_data;
|
40 |
+
add_theme_page( $jr_mt_plugin_data['Name'], 'Multiple Themes plugin', 'switch_themes', 'jr_mt_settings', 'jr_mt_settings_page' );
|
41 |
+
add_options_page( $jr_mt_plugin_data['Name'], 'Multiple Themes plugin', 'switch_themes', 'jr_mt_settings', 'jr_mt_settings_page' );
|
42 |
+
/* Cleanup Settings before using them.
|
43 |
+
Presently, this just checks for Themes that are no longer installed,
|
44 |
+
but are referenced in the Settings.
|
45 |
+
Settings referencing such Themes are deleted.
|
46 |
+
*/
|
47 |
+
require_once( jr_mt_path() . 'includes/settings-cleanup.php' );
|
48 |
+
}
|
49 |
+
|
50 |
+
global $jr_mt_kwvalsep;
|
51 |
+
/* Everything is converted to lower-case, so upper-case letter makes a good keyword-value separator
|
52 |
+
*/
|
53 |
+
$jr_mt_kwvalsep = 'A';
|
54 |
+
|
55 |
+
add_action( 'admin_enqueue_scripts', 'jr_mt_admin_enqueue_scripts' );
|
56 |
+
function jr_mt_admin_enqueue_scripts() {
|
57 |
+
global $jr_mt_plugin_data;
|
58 |
+
wp_enqueue_script( 'jr_mt_tabs', plugins_url() . '/' . dirname( jr_mt_plugin_basename() ) . '/js/tabs.js', array(), $jr_mt_plugin_data['Version'] );
|
59 |
+
}
|
60 |
+
|
61 |
+
/**
|
62 |
+
* Settings page for plugin
|
63 |
+
*
|
64 |
+
* Display and Process Settings page for this plugin.
|
65 |
+
*
|
66 |
+
*/
|
67 |
+
function jr_mt_settings_page() {
|
68 |
+
global $jr_mt_plugin_data, $jr_mt_plugins_cache;
|
69 |
+
$jr_mt_plugins_cache = get_plugins();
|
70 |
+
add_thickbox();
|
71 |
+
echo '<div class="wrap">';
|
72 |
+
echo '<h2>' . $jr_mt_plugin_data['Name'] . '</h2>';
|
73 |
+
|
74 |
+
// Required because it is only called automatically for Admin Pages in the Settings section
|
75 |
+
settings_errors( 'jr_mt_settings' );
|
76 |
+
|
77 |
+
$theme_obj = wp_get_theme();
|
78 |
+
$theme = $theme_obj->Name;
|
79 |
+
$theme_version = $theme_obj->Version;
|
80 |
+
global $jr_mt_options_cache;
|
81 |
+
|
82 |
+
$current_wp_version = get_bloginfo( 'version' );
|
83 |
+
|
84 |
+
global $jr_mt_plugins_cache;
|
85 |
+
|
86 |
+
$compatible = TRUE;
|
87 |
+
|
88 |
+
// Check for incompatible plugins that have been activated: BuddyPress and Theme Test Drive
|
89 |
+
global $jr_mt_incompat_plugins;
|
90 |
+
foreach ( $jr_mt_plugins_cache as $rel_path => $plugin_data ) {
|
91 |
+
if ( in_array( $plugin_data['Name'], $jr_mt_incompat_plugins ) && is_plugin_active( $rel_path ) ) {
|
92 |
+
if ( $compatible ) {
|
93 |
+
echo '<h3>Plugin Conflict Error Detected</h3>';
|
94 |
+
$compatible = FALSE;
|
95 |
+
}
|
96 |
+
echo '<p>This Plugin (' . $jr_mt_plugin_data['Name'] . ') cannot be used when the <b>' . $plugin_data['Name']
|
97 |
+
. '</b> plugin is Activated. If you wish to use the ' . $jr_mt_plugin_data['Name']
|
98 |
+
. ' plugin, please deactivate the ' . $plugin_data['Name']
|
99 |
+
. ' plugin (not just when viewing this Settings page, but whenever the '
|
100 |
+
. $jr_mt_plugin_data['Name'] . ' plugin is activated).</p>';
|
101 |
+
}
|
102 |
+
}
|
103 |
+
|
104 |
+
if ( $compatible ) {
|
105 |
+
$settings = get_option( 'jr_mt_settings' );
|
106 |
+
$internal_settings = get_option( 'jr_mt_internal_settings' );
|
107 |
+
?>
|
108 |
+
<h2 class="nav-tab-wrapper">
|
109 |
+
<a href="#" class="nav-tab nav-tab-active" id="jr-mt-tabs1"
|
110 |
+
onClick="jrMtTabs( 1, 5 );">Settings</a><a href="#" class="nav-tab" id="jr-mt-tabs2"
|
111 |
+
onClick="jrMtTabs( 2, 5 );">Advanced Settings</a><a href="#" class="nav-tab" id="jr-mt-tabs3"
|
112 |
+
onClick="jrMtTabs( 3, 5 );">Theme Options</a><a href="#" class="nav-tab" id="jr-mt-tabs4"
|
113 |
+
onClick="jrMtTabs( 4, 5 );">System Information</a><a href="#" class="nav-tab" id="jr-mt-tabs5"
|
114 |
+
onClick="jrMtTabs( 5, 5 );">New in V5</a>
|
115 |
+
</h2>
|
116 |
+
<div id="jr-mt-settings1">
|
117 |
+
<h3>Settings</h3>
|
118 |
+
<p>
|
119 |
+
This is the main Settings tab.
|
120 |
+
Additional Settings are available on the
|
121 |
+
<a href="#" onClick="jrMtTabs( 2, 5 );">Advanced Settings tab</a>,
|
122 |
+
but they can cause problems,
|
123 |
+
so should be used with care.
|
124 |
+
</p>
|
125 |
+
<h3>Overview</h3>
|
126 |
+
<p>This Plugin allows you to selectively display Themes on your web site
|
127 |
+
other than the Theme shown as
|
128 |
+
<b>
|
129 |
+
Active
|
130 |
+
</b>
|
131 |
+
on
|
132 |
+
<b>
|
133 |
+
Appearance-Themes
|
134 |
+
</b>
|
135 |
+
in the WordPress Admin panels.
|
136 |
+
</p>
|
137 |
+
<p>
|
138 |
+
Below,
|
139 |
+
Theme Selection entries can be created
|
140 |
+
where each Entry specifies which of the installed themes shown on the Appearance-Themes Admin panel will be applied to:
|
141 |
+
<ul>
|
142 |
+
<li> » The Site Home</li>
|
143 |
+
<li> » An exact URL of any non-Admin page on this WordPress Site</li>
|
144 |
+
<li> » One or more URLs that begin with the partial URL you specify ("URL Prefix")</li>
|
145 |
+
<li> » One or more URLs that begin with the wildcard URL you specify ("URL Prefix*")</li>
|
146 |
+
<li> » Any URL containing a Specific Query Keyword (<code>?keyword</code> or <code>&keyword</code>)</li>
|
147 |
+
<li> » Any URL containing a Specific Query Keyword/Value pair (<code>?keyword=value</code> or <code>&keyword=value</code>)</li>
|
148 |
+
<li> » For the same site visitor, all non-Admin pages after a <b>Sticky</b> Query Keyword/Value pair is specified in any URL (Advanced Settings tab)</li>
|
149 |
+
<li> » All Pages (Advanced Settings tab)</li>
|
150 |
+
<li> » All Posts (Advanced Settings tab)</li>
|
151 |
+
<li> » Everything else, except what is specified above (Advanced Settings tab)</li>
|
152 |
+
</ul>
|
153 |
+
</p>
|
154 |
+
<h3>Important Notes</h3>
|
155 |
+
<form action="options.php" method="POST">
|
156 |
+
<?php
|
157 |
+
$permalink = get_option( 'permalink_structure' );
|
158 |
+
if ( isset( $internal_settings['permalink'] ) ) {
|
159 |
+
if ( $internal_settings['permalink'] !== $permalink ) {
|
160 |
+
/* Permalink Structure has been changed.
|
161 |
+
*/
|
162 |
+
if ( empty( $settings['url'] ) && empty( $settings['url_prefix'] ) && empty( $settings['url_asterisk'] ) ) {
|
163 |
+
$update = TRUE;
|
164 |
+
} else {
|
165 |
+
?>
|
166 |
+
<p>
|
167 |
+
Permalink Structure has been changed.
|
168 |
+
In the
|
169 |
+
<b>
|
170 |
+
Current Theme Selection Entries
|
171 |
+
</b>
|
172 |
+
Section just below,
|
173 |
+
please review all
|
174 |
+
URL=,
|
175 |
+
URL Prefix=
|
176 |
+
and
|
177 |
+
URL Prefix*=
|
178 |
+
entries,
|
179 |
+
as they may need to be changed to reflect the new Permalink Structure.
|
180 |
+
<br />
|
181 |
+
<input type="checkbox" id="permalink" name="jr_mt_settings[permalink]" value="true" />
|
182 |
+
Dismiss Warning
|
183 |
+
</p>
|
184 |
+
<?php
|
185 |
+
$update = FALSE;
|
186 |
+
}
|
187 |
+
} else {
|
188 |
+
$update = FALSE;
|
189 |
+
}
|
190 |
+
} else {
|
191 |
+
/* Permalink Internal Setting for Plugin not set,
|
192 |
+
so initialize it to current Permalink Structure.
|
193 |
+
*/
|
194 |
+
$update = TRUE;
|
195 |
+
}
|
196 |
+
if ( $update ) {
|
197 |
+
$internal_settings['permalink'] = $permalink;
|
198 |
+
update_option( 'jr_mt_internal_settings', $internal_settings );
|
199 |
+
}
|
200 |
+
if ( function_exists('is_multisite') && is_multisite() ) {
|
201 |
+
echo "In a WordPress Network (AKA Multisite), Themes must be <b>Network Enabled</b> before they will appear as Available Themes on individual sites' Appearance-Themes panel.";
|
202 |
+
}
|
203 |
+
echo '<p>';
|
204 |
+
echo "The Active Theme, defined to WordPress in the Appearance-Themes admin panel, is <b>$theme</b>.";
|
205 |
+
if ( trim( $settings['current'] ) ) {
|
206 |
+
echo " But it is being overridden by the Theme for Everything setting (see Advanced Settings tab), which set the plugin's default Theme to <b>";
|
207 |
+
echo wp_get_theme( $settings['current'] )->Name;
|
208 |
+
echo '</b>. You will not normally need to specify this default Theme in any of the other Settings on this page, though you will need to specify the WordPress Active Theme wherever you want it to appear. Or, if you specify, on the Advanced Settings tab, a different Theme for All Pages, All Posts or Everything, and wish to use the default Theme for one or more specific Pages, Posts or other non-Admin pages.';
|
209 |
+
} else {
|
210 |
+
echo ' You will not normally need to specify it in any of the Settings on this page. The only exception would be if you specify, on the Advanced Settings tab, a different Theme for All Pages, All Posts or Everything, and wish to use the Active Theme for one or more specific Pages, Posts or other non-Admin pages.';
|
211 |
+
}
|
212 |
+
echo '</p>';
|
213 |
+
|
214 |
+
if ( jr_mt_plugin_update_available() ) {
|
215 |
+
echo '<p>A new version of this Plugin (' . $jr_mt_plugin_data['Name'] . ') is available from the WordPress Repository.'
|
216 |
+
. ' Updating as quickly as possible is strongly recommend because new versions fix problems that users like you have already reported.'
|
217 |
+
. ' <a class="thickbox" title="' . $jr_mt_plugin_data['Name'] . '" href="' . network_admin_url()
|
218 |
+
. 'plugin-install.php?tab=plugin-information&plugin=' . $jr_mt_plugin_data['slug']
|
219 |
+
. '§ion=changelog&TB_iframe=true&width=640&height=768">Click here</a> for more details.</p>';
|
220 |
+
}
|
221 |
+
?>
|
222 |
+
<p>
|
223 |
+
If a newly-added Theme Selection does not seem to be working,
|
224 |
+
especially if the associated web page does not display properly,
|
225 |
+
try deactivating any plugins that provide Caching.
|
226 |
+
You may find that you have to flush the plugin's Cache whenever you add or change a Theme Selection setting.
|
227 |
+
Also note that some Caching plugins only cache for visitors who are not logged in,
|
228 |
+
so be sure to check your site after logging out.
|
229 |
+
</p>
|
230 |
+
<p>
|
231 |
+
Need more help?
|
232 |
+
Please scroll to the bottom of this Settings page for more information.
|
233 |
+
</p>
|
234 |
+
<hr />
|
235 |
+
<?php
|
236 |
+
|
237 |
+
// Plugin Settings are displayed and entered here:
|
238 |
+
settings_fields( 'jr_mt_settings' );
|
239 |
+
do_settings_sections( 'jr_mt_settings_page' );
|
240 |
+
echo '<p><input name="save" type="submit" value="Save All Changes" class="button-primary" /></p></form>';
|
241 |
+
}
|
242 |
+
|
243 |
+
?>
|
244 |
+
</div>
|
245 |
+
<div id="jr-mt-settings3" style="display: none;">
|
246 |
+
<h3>
|
247 |
+
Theme Options and Template Selection
|
248 |
+
</h3>
|
249 |
+
<p>
|
250 |
+
This tab provides information on changing Theme Options
|
251 |
+
(Widgets, Sidebars, Menus, Background, Header, etc.)
|
252 |
+
for all the different Themes used on a WordPress site.
|
253 |
+
</p>
|
254 |
+
<p>
|
255 |
+
Information on changing the Template for each Page or Post
|
256 |
+
is found near the bottom of this tab.
|
257 |
+
</p>
|
258 |
+
<h3>
|
259 |
+
Changing Theme Options
|
260 |
+
</h3>
|
261 |
+
<p>
|
262 |
+
For the Active Theme, nothing changes when using the jonradio Multiple Themes plugin.
|
263 |
+
Options for the Active Theme,
|
264 |
+
including Widgets, Sidebars, Menus, Background, Header and other Customizations supported by the Theme,
|
265 |
+
can be modified in the Admin panel using the Appearance menu items on the left sidebar.
|
266 |
+
Some Themes also provide their own menu items in the left sidebar of the Admin panel,
|
267 |
+
and these will still appear for the Active Theme when using this plugin.
|
268 |
+
</p>
|
269 |
+
<p>
|
270 |
+
It is more difficult to modify Options for installed Themes that are not the WordPress Active Theme.
|
271 |
+
Building this functionality into this plugin is in the plans for a future Version,
|
272 |
+
but it is not clear just how practical that is, so the best that can be said is:
|
273 |
+
<i>
|
274 |
+
Maybe</i>.
|
275 |
+
</p>
|
276 |
+
<p>
|
277 |
+
For now, there are three approaches that can be used to change Options for an installed Theme that is not the Active Theme.
|
278 |
+
The first works best if only one Theme has a lot of Options that need to be changed frequently:
|
279 |
+
</p>
|
280 |
+
<ol>
|
281 |
+
<li>
|
282 |
+
Make that Theme the Active Theme defined in the Appearance-Themes WordPress admin panel;
|
283 |
+
</li>
|
284 |
+
<li>
|
285 |
+
If that meant changing the Active Theme,
|
286 |
+
the previous Active Theme can be selected on the plugin's
|
287 |
+
<b>
|
288 |
+
Advanced Settings
|
289 |
+
</b>
|
290 |
+
tab
|
291 |
+
in the
|
292 |
+
<b>
|
293 |
+
Select Theme for Everything
|
294 |
+
</b>
|
295 |
+
field
|
296 |
+
and it will be used everywhere except where you have specified
|
297 |
+
another Theme in the Theme Selection entries for this plugin.
|
298 |
+
</li>
|
299 |
+
</ol>
|
300 |
+
<p>
|
301 |
+
For other situations,
|
302 |
+
two multi-step Methods are available,
|
303 |
+
and are described in the two Sections below.
|
304 |
+
Both Methods work for most Theme Options,
|
305 |
+
with the following exceptions:
|
306 |
+
</p>
|
307 |
+
<ol>
|
308 |
+
<li>
|
309 |
+
Menus really work well with Method #1,
|
310 |
+
but are severely restricted with Method #2;
|
311 |
+
</li>
|
312 |
+
<li>
|
313 |
+
Widgets normally only work with Method #2;
|
314 |
+
</li>
|
315 |
+
<li>
|
316 |
+
Using both Methods may cause conflicts;
|
317 |
+
</li>
|
318 |
+
<li>
|
319 |
+
No matter which Method you choose,
|
320 |
+
you may lose previously-set Theme Options.
|
321 |
+
A Backup and Recovery of your WordPress Database
|
322 |
+
would be required to avoid such a loss.
|
323 |
+
</li>
|
324 |
+
</ol>
|
325 |
+
<h4>
|
326 |
+
<u>
|
327 |
+
Method #1</u>:
|
328 |
+
Set the Theme Options with Live Preview.
|
329 |
+
</h4>
|
330 |
+
<p>
|
331 |
+
Note: Widgets cannot be placed using this Method.
|
332 |
+
</p>
|
333 |
+
<ol>
|
334 |
+
<li>
|
335 |
+
Go to Appearance-Themes in the WordPress Admin panels.
|
336 |
+
</li>
|
337 |
+
<li>
|
338 |
+
Mouse over the Theme that you wish to change
|
339 |
+
and click the Live Preview button that appears.
|
340 |
+
</li>
|
341 |
+
<li>
|
342 |
+
Use the left sidebar to modify the Theme Options.
|
343 |
+
Note that
|
344 |
+
<b>
|
345 |
+
Navigation
|
346 |
+
</b>
|
347 |
+
will not appear in the Live Preview sidebar until a Menu has been defined in Appearance-Menus.
|
348 |
+
Navigation is where you would set the custom menu(s) to be used for the Theme you are currently previewing.
|
349 |
+
</li>
|
350 |
+
<li>
|
351 |
+
Click the Save & Activate button.
|
352 |
+
</li>
|
353 |
+
<li>
|
354 |
+
Go immediately to Appearance-Themes in the WordPress Admin panels.
|
355 |
+
</li>
|
356 |
+
<li>
|
357 |
+
Mouse over the Theme that had previously been the Active Theme
|
358 |
+
and click the Activate button that appears
|
359 |
+
to reactivate the Active Theme.
|
360 |
+
</li>
|
361 |
+
</ol>
|
362 |
+
<h4>
|
363 |
+
<u>
|
364 |
+
Method #2</u>:
|
365 |
+
Use the Theme Test Drive plugin.
|
366 |
+
</h4>
|
367 |
+
<p>
|
368 |
+
Note: this approach only allows Menus to be set for one Theme. Using this method to assign one or more menus to a Theme will unassign menus for all other Themes.
|
369 |
+
</p>
|
370 |
+
<p>
|
371 |
+
The jonradio Multiple Themes plugin (i.e. - this plugin) must be Deactivated,
|
372 |
+
and the Theme Test Drive plugin installed and activated.
|
373 |
+
This enables each Theme to be selected with the Theme Test Drive plugin,
|
374 |
+
allowing the Theme's Options to be set
|
375 |
+
<i>
|
376 |
+
as if
|
377 |
+
</i>
|
378 |
+
it were the Active Theme.
|
379 |
+
</p>
|
380 |
+
<ol>
|
381 |
+
<li>
|
382 |
+
Deactivate the jonradio Multiple Themes plugin.
|
383 |
+
</li>
|
384 |
+
<li>
|
385 |
+
Install the Theme Test Drive plugin found at
|
386 |
+
<a target="_blank" href="http://wordpress.org/plugins/theme-test-drive/">http://wordpress.org/plugins/theme-test-drive/</a>.
|
387 |
+
</li>
|
388 |
+
<li>
|
389 |
+
Activate the Theme Test Drive plugin.
|
390 |
+
</li>
|
391 |
+
<li>
|
392 |
+
Go to
|
393 |
+
<b>
|
394 |
+
Appearance-Theme Test Drive
|
395 |
+
</b>
|
396 |
+
in the WordPress Admin panels.
|
397 |
+
</li>
|
398 |
+
<li>
|
399 |
+
In the Usage section, select a Theme whose Options you wish to change.
|
400 |
+
</li>
|
401 |
+
<li>
|
402 |
+
Push the Enable Theme Drive button at the bottom of the Admin panel.
|
403 |
+
</li>
|
404 |
+
<li>
|
405 |
+
Make your changes to the Theme Options, including Widgets, Sidebars, Menus (see note above about Menus), Background, Header and other Customizations for this alternate Theme
|
406 |
+
using the Appearance submenu
|
407 |
+
in the WordPress Admin panels,
|
408 |
+
just as you would for the Active Theme.
|
409 |
+
</li>
|
410 |
+
<li>
|
411 |
+
If more than one Theme has Options that need changing, repeat Steps 4-8 for each Theme
|
412 |
+
(except the Active Theme,
|
413 |
+
which should be only changed
|
414 |
+
<i>
|
415 |
+
without
|
416 |
+
</i>
|
417 |
+
the Theme Test Drive plugin activated).
|
418 |
+
</li>
|
419 |
+
<li>
|
420 |
+
Deactivate the Theme Test Drive plugin.
|
421 |
+
</li>
|
422 |
+
<li>
|
423 |
+
Activate this plugin (jonradio Multiple Themes).
|
424 |
+
</li>
|
425 |
+
<li>
|
426 |
+
Changes to the Options for the Active Theme can now be made normally, just as you would without either plugin.
|
427 |
+
</li>
|
428 |
+
<li>
|
429 |
+
Both the alternate and Active Themes should now display all Theme options properly when selected through the jonradio Multiple Themes plugin.
|
430 |
+
</li>
|
431 |
+
</ol>
|
432 |
+
<h3>
|
433 |
+
Changing Templates
|
434 |
+
</h3>
|
435 |
+
<p>
|
436 |
+
Many Themes provide more than one Template.
|
437 |
+
For each Page or Post, you can select the Template you want to use for that Page or Post.
|
438 |
+
</p>
|
439 |
+
<p>
|
440 |
+
For the Active Theme, nothing changes when using the jonradio Multiple Themes plugin.
|
441 |
+
Select an alternate Template from the drop-down list in the Template field of the Page Attributes section of the Add New Page, Edit Page, Add New Post or Edit Post page of the Admin panels.
|
442 |
+
Or the Template field in Quick Edit.
|
443 |
+
</p>
|
444 |
+
<p>
|
445 |
+
It is more difficult to change Templates for Pages or Posts defined with the jonradio Multiple Themes plugin to use Installed Themes that are not the Active Theme.
|
446 |
+
Building this functionality into this plugin is in the plans for a future Version.
|
447 |
+
</p>
|
448 |
+
<p>
|
449 |
+
Use the Theme Test Drive plugin.
|
450 |
+
The jonradio Multiple Themes plugin (i.e. - this plugin) must be Deactivated, and the Theme Test Drive plugin installed and activated,
|
451 |
+
so that each Theme can be selected with the Theme Test Drive plugin,
|
452 |
+
allowing the Theme's Template to be set for each Page or Post using that Theme
|
453 |
+
<i>
|
454 |
+
as if
|
455 |
+
</i>
|
456 |
+
it were the Active Theme.
|
457 |
+
</p>
|
458 |
+
<ol>
|
459 |
+
<li>
|
460 |
+
Deactivate the jonradio Multiple Themes plugin.
|
461 |
+
</li>
|
462 |
+
<li>
|
463 |
+
Install the Theme Test Drive plugin found at
|
464 |
+
<a target="_blank" href="http://wordpress.org/plugins/theme-test-drive/">http://wordpress.org/plugins/theme-test-drive/</a>.
|
465 |
+
</li>
|
466 |
+
<li>
|
467 |
+
Activate the Theme Test Drive plugin.
|
468 |
+
</li>
|
469 |
+
<li>
|
470 |
+
Go to
|
471 |
+
<b>
|
472 |
+
Appearance-Theme Test Drive
|
473 |
+
</b>
|
474 |
+
in the WordPress Admin panels.
|
475 |
+
</li>
|
476 |
+
<li>
|
477 |
+
In the Usage section, select a Theme whose Templates need to be changed for a Post or Page.
|
478 |
+
</li>
|
479 |
+
<li>
|
480 |
+
Push the Enable Theme Drive button at the bottom of the Admin panel.
|
481 |
+
</li>
|
482 |
+
<li>
|
483 |
+
Go to Posts-All Posts or Pages-All Pages in the WordPress Admin panels.
|
484 |
+
</li>
|
485 |
+
<li>
|
486 |
+
For each Page or Post where a Template needs to be changed for this Theme,
|
487 |
+
mouse over the Page or Post title and click on Quick Edit.
|
488 |
+
</li>
|
489 |
+
<li>
|
490 |
+
Change the Template field.
|
491 |
+
</li>
|
492 |
+
<li>
|
493 |
+
Click the Update button.
|
494 |
+
</li>
|
495 |
+
<li>
|
496 |
+
Repeat Steps 8-10 for each Page or Post that requires a change to Template for this Theme.
|
497 |
+
</li>
|
498 |
+
<li>
|
499 |
+
If more than one Theme has Pages or Posts with Templates that need to be changed,
|
500 |
+
repeat Steps 4-11 for each Theme
|
501 |
+
(except the Active Theme,
|
502 |
+
where Template changes should only be made
|
503 |
+
<i>
|
504 |
+
without
|
505 |
+
</i>
|
506 |
+
the Theme Test Drive plugin activated).
|
507 |
+
</li>
|
508 |
+
<li>
|
509 |
+
Deactivate the Theme Test Drive plugin.
|
510 |
+
</li>
|
511 |
+
<li>
|
512 |
+
Activate this plugin (jonradio Multiple Themes).
|
513 |
+
</li>
|
514 |
+
<li>
|
515 |
+
Changing Templates for the Active Theme can now be made normally, just as you would without either plugin.
|
516 |
+
</li>
|
517 |
+
<li>
|
518 |
+
Both the alternate and Active Themes should now display the correct Template when selected through the jonradio Multiple Themes plugin.
|
519 |
+
</li>
|
520 |
+
</ol>
|
521 |
+
</div>
|
522 |
+
<div id="jr-mt-settings4" style="display: none;">
|
523 |
+
<h3>
|
524 |
+
System Information
|
525 |
+
</h3>
|
526 |
+
<?php
|
527 |
+
$posix = function_exists( 'posix_uname' );
|
528 |
+
echo '<p>You are currently running:<ul>';
|
529 |
+
echo "<li> » The {$jr_mt_plugin_data['Name']} plugin Version {$jr_mt_plugin_data['Version']}</li>";
|
530 |
+
echo "<li> »» The Path to the plugin's directory is <code>" . rtrim( jr_mt_path(), '/' ) . '</code></li>';
|
531 |
+
echo "<li> »» The URL to the plugin's directory is <code>" . plugins_url() . "/{$jr_mt_plugin_data['slug']}</code></li>";
|
532 |
+
echo "<li> » The Active Theme is $theme Version $theme_version</li>";
|
533 |
+
echo "<li> »» The Path to the Active Theme's stylesheet directory is <code>" . get_stylesheet_directory() . '</code></li>';
|
534 |
+
echo "<li> »» The Path to the Active Theme's template directory is <code>" . get_template_directory() . '</code></li>';
|
535 |
+
$permalink = get_option( 'permalink_structure' );
|
536 |
+
if ( empty( $permalink ) ) {
|
537 |
+
$permalink = 'Default (Query <code>/?p=123</code>)';
|
538 |
+
} else {
|
539 |
+
$permalink = "<code>$permalink</code>";
|
540 |
+
}
|
541 |
+
echo "<li> » The current Permalink Structure is $permalink";
|
542 |
+
echo "<li> » WordPress Version $current_wp_version</li>";
|
543 |
+
echo '<li> »» WordPress language is set to ' , get_bloginfo( 'language' ) . '</li>';
|
544 |
+
echo '<li> » ' . php_uname( 's' ) . ' operating system, Release/Version ' . php_uname( 'r' ) . ' / ' . php_uname( 'v' ) . '</li>';
|
545 |
+
if ( $posix ) {
|
546 |
+
$array = posix_getpwuid( posix_getuid() );
|
547 |
+
$user = $array['name'];
|
548 |
+
echo "<li> » Real operating system User ID that runs WordPress is $user</li>";
|
549 |
+
$array = posix_getpwuid( posix_geteuid() );
|
550 |
+
$user = $array['name'];
|
551 |
+
echo "<li> » Effective operating system User ID that runs WordPress is $user</li>";
|
552 |
+
}
|
553 |
+
echo '<li> » ' . php_uname( 'm' ) . ' computer hardware</li>';
|
554 |
+
echo '<li> » Host name ' . php_uname( 'n' ) . '</li>';
|
555 |
+
echo '<li> » php Version ' . phpversion() . '</li>';
|
556 |
+
echo '<li> »» php memory_limit ' . ini_get('memory_limit') . '</li>';
|
557 |
+
if ( !$posix ) {
|
558 |
+
echo '<li> »» POSIX functions are not available</li>';
|
559 |
+
}
|
560 |
+
echo '<li> » Zend engine Version ' . zend_version() . '</li>';
|
561 |
+
echo '<li> » Web Server software is ' . getenv( 'SERVER_SOFTWARE' ) . '</li>';
|
562 |
+
if ( function_exists( 'apache_get_version' ) && ( FALSE !== $apache = apache_get_version() ) ) {
|
563 |
+
echo "<li> »» Apache Version $apache</li>";
|
564 |
+
}
|
565 |
+
global $wpdb;
|
566 |
+
echo '<li> » MySQL Version ' . $wpdb->get_var( 'SELECT VERSION();', 0, 0 ) . '</li>';
|
567 |
+
|
568 |
+
echo '</ul></p>';
|
569 |
+
|
570 |
+
$paths = array(
|
571 |
+
'/..',
|
572 |
+
'/',
|
573 |
+
'/wp-content/',
|
574 |
+
'/wp-content/plugins/',
|
575 |
+
'/wp-content/plugins/' . dirname( jr_mt_plugin_basename() ),
|
576 |
+
'/wp-content/plugins/' . dirname( jr_mt_plugin_basename() ) . '/readme.txt'
|
577 |
+
);
|
578 |
+
echo '<h3>File Permissions</h3><p>All of the Paths shown below are relative to the WordPress Site Path <code>'
|
579 |
+
. ABSPATH
|
580 |
+
. '</code><br />The first is the Parent Directory <code>'
|
581 |
+
. dirname( ABSPATH )
|
582 |
+
. '/</code> and the second is the WordPress Site Path itself.</p><table class="widefat"><thead><tr><th>Path</th><th>Type</th><th>Read</th><th>Write</th>';
|
583 |
+
if ( $posix ) {
|
584 |
+
echo '<th>Owner</th><th>Group</th>';
|
585 |
+
}
|
586 |
+
echo '</tr></thead><tbody>';
|
587 |
+
foreach ( $paths as $path ) {
|
588 |
+
$full_path = ABSPATH . substr( $path, 1 );
|
589 |
+
if ( is_dir( $full_path ) ) {
|
590 |
+
$type = 'Directory';
|
591 |
+
} else {
|
592 |
+
$type = 'File';
|
593 |
+
}
|
594 |
+
if ( is_readable( $full_path ) ) {
|
595 |
+
$read = 'Yes';
|
596 |
+
} else {
|
597 |
+
$read = 'No';
|
598 |
+
}
|
599 |
+
if ( is_writeable( $full_path ) ) {
|
600 |
+
$write = 'Yes';
|
601 |
+
} else {
|