Changeset 1684621
- Timestamp:
- 06/24/2017 06:51:39 AM (9 years ago)
- Location:
- theme-changer/trunk
- Files:
-
- 2 edited
-
readme.txt (modified) (2 diffs)
-
theme-changer.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
theme-changer/trunk/readme.txt
r1055930 r1684621 3 3 Tags: theme,change,get,parameter,demo 4 4 Requires at least: 3.0 5 Tested up to: 3.06 Stable tag: 1. 35 Tested up to: 4.8 6 Stable tag: 1.1 7 7 License: GPLv2 or later 8 8 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 30 30 = 1.0 = 31 31 * First release. 32 33 = 1.1 = 34 * While logging in to the management screen, we prepared a watermark for changing the theme to the lower left. -
theme-changer/trunk/theme-changer.php
r1055931 r1684621 2 2 /* 3 3 Plugin Name: Theme Changer 4 Plugin URI: http://www.elegants.biz/ products/theme-changer/4 Plugin URI: http://www.elegants.biz/theme-changer.php 5 5 Description: Easy theme change in the get parameter. this to be a per-session only change, and one that everyone (all visitors) can use. I just enter the following URL. It's easy. e.g. http://wordpress_install_domain/?theme_changer=theme_folder_name 6 Version: 1. 06 Version: 1.1 7 7 Author: momen2009 8 8 Author URI: http://www.elegants.biz/ 9 9 License: GPLv2 or later 10 */11 12 /* Copyright 201 4 ØÈÌDëÈêú(email : momen.yutaka@gmail.com)10 */ 11 12 /* Copyright 2017 木綿の優雅な一日 (email : momen.yutaka@gmail.com) 13 13 14 14 This program is free software; you can redistribute it and/or modify … … 24 24 along with this program; if not, write to the Free Software 25 25 Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA 26 */26 */ 27 27 28 28 $theme_changer_theme; … … 80 80 add_filter('template', 'my_theme_switcher'); 81 81 } 82 83 add_action('init', 'theme_changer_logged_in'); 84 85 function theme_changer_logged_in(){ 86 if (is_user_logged_in()) { 87 add_action('wp_footer', 'theme_changer_footer' ); 88 } 89 } 90 91 function theme_changer_footer() { 92 global $theme_changer_theme; 93 $output .= "<style>#theme_changer{z-index:1000 !important;position:fixed;padding:10px;bottom:10px;left:10px;opacity:0.2;}#theme_changer label {color: #333 !important;display: block !important;font-weight: 800 !important;margin-bottom: 0.5em !important;font-family: 'Hiragino Kaku Gothic Pro', Meiryo, sans-serif !important;font-size: 16px !important;}#theme_changer select {font-weight:normal !important;font-size: 16px !important;color: #333 !important;border: 1px solid #bbb !important;-webkit-border-radius: 3px !important;border-radius: 3px !important;height: 3em !important;max-width: 100% !important;}#theme_changer p {font-size: 9px;}</style><script>jQuery(document).ready(function(){jQuery('#theme_changer select').change(function() {if (jQuery(this).val() != '') {insertParameter('theme_changer',jQuery(this).val());}});});function insertParameter(key, value){key = encodeURI(key); value = encodeURI(value);var kvp = document.location.search.substr(1).split('&');var i=kvp.length; var x; while(i--) {x = kvp[i].split('=');if (x[0]==key){x[1] = value;kvp[i] = x.join('=');break;}}if(i<0) {kvp[kvp.length] = [key,value].join('=');}document.location.search = kvp.join('&');} jQuery('body').append('"; 94 $output .= "<div id=\"theme_changer\"><label for=\"theme_changer_select\">Theme Changer</label><select id=\"theme_changer_select\">"; 95 96 foreach(wp_get_themes() as $value){ 97 $output .= "<option value=\""; 98 $output .= $value -> get_stylesheet(); 99 $output .= "\""; 100 if($value -> get_stylesheet() == $theme_changer_theme){ 101 $output .= " selected"; 102 } 103 $output .= ">"; 104 $output .= $value -> Name; 105 $output .= "</option>"; 106 } 107 $output .= "<select><p>This will only be displayed if you are logged in.</p></div>');</script>"; 108 echo $output; 109 } 82 110 ?>
Note: See TracChangeset
for help on using the changeset viewer.