Plugin Directory

Changeset 1684621


Ignore:
Timestamp:
06/24/2017 06:51:39 AM (9 years ago)
Author:
momen2009
Message:

While logging in to the management screen, we prepared a watermark for changing the theme to the lower left.

Location:
theme-changer/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • theme-changer/trunk/readme.txt

    r1055930 r1684621  
    33Tags: theme,change,get,parameter,demo
    44Requires at least: 3.0
    5 Tested up to: 3.0
    6 Stable tag: 1.3
     5Tested up to: 4.8
     6Stable tag: 1.1
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    3030= 1.0 =
    3131* 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  
    22/*
    33Plugin Name: Theme Changer
    4 Plugin URI: http://www.elegants.biz/products/theme-changer/
     4Plugin URI: http://www.elegants.biz/theme-changer.php
    55Description: 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.0
     6Version: 1.1
    77Author: momen2009
    88Author URI: http://www.elegants.biz/
    99License: GPLv2 or later
    10  */
    11  
    12 /*  Copyright 2014 –ؖȂ̗D‰ë‚Ȉê“ú (email : momen.yutaka@gmail.com)
     10*/
     11
     12/*  Copyright 2017 木綿の優雅な一日 (email : momen.yutaka@gmail.com)
    1313
    1414This program is free software; you can redistribute it and/or modify
     
    2424along with this program; if not, write to the Free Software
    2525Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
    26  */
     26*/
    2727
    2828$theme_changer_theme;
     
    8080    add_filter('template', 'my_theme_switcher');
    8181}
     82
     83add_action('init', 'theme_changer_logged_in');
     84
     85function theme_changer_logged_in(){
     86    if (is_user_logged_in()) {
     87        add_action('wp_footer', 'theme_changer_footer' );
     88    }
     89}
     90
     91function 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}
    82110?>
Note: See TracChangeset for help on using the changeset viewer.