Plugin Directory

Changeset 1085507


Ignore:
Timestamp:
02/09/2015 01:06:17 PM (11 years ago)
Author:
wpnaga
Message:

Plugin 1.3 - Position Update

File:
1 edited

Legend:

Unmodified
Added
Removed
  • wp-sticky-header/trunk/wp-sticky-header.php

    r1001076 r1085507  
    44 * Plugin URI: http://wordpress.org/plugins/wp-sticky-header/
    55 * Description: Plugin to display some content/notification on top of the webpage.
    6  * Version: 1.2
     6 * Version: 1.3
    77 * Author: wpnaga
    88 * Author URI: http://profiles.wordpress.org/wpnaga/
     
    2929    register_setting( 'wpsh-settings-group', 'wpsh_text_color' );
    3030    register_setting( 'wpsh-settings-group', 'wpsh_closable' );
     31    register_setting( 'wpsh-settings-group', 'wpsh_position' );
    3132    register_setting( 'wpsh-settings-group', 'wpsh_content' );
    3233    register_setting( 'wpsh-settings-group', 'wpsh_where' ); 
     
    5657        <th scope="row">Is Closable?</th>
    5758        <td><input type="checkbox" name="wpsh_closable" value="1" <?php if(esc_attr( get_option('wpsh_closable'))) echo "checked"; ?> /> &nbsp;&nbsp;can the viewer close the header?</td>
     59        </tr>
     60       
     61        <tr valign="top">
     62        <th scope="row">Position</th>
     63        <td>
     64            <p><input type="radio" class="display" name="wpsh_position" value="top" <?php if(esc_attr( get_option('wpsh_position')) == "top") echo "checked"; ?> /><b>Top</b> </p>
     65            <p><input type="radio" class="display" name="wpsh_position" value="bottom" <?php if(esc_attr( get_option('wpsh_position')) == "bottom") echo "checked"; ?> /><b>Bottom</b> </p>
     66        </td>
    5867        </tr>
    5968       
     
    151160            position: fixed;
    152161            text-align: center;
    153             top: 0;
     162            <?php if(esc_attr(get_option('wpsh_position')) == 'top') { echo "top: 0;"; } else { echo "bottom:0;"; } ?>
    154163            font-weight:bold;
    155164            width: 100%;
     
    164173            margin-right:30px;
    165174            font-weight:bold;
    166             padding:5px;
    167175        }
    168176        .wpsh_close:hover{
     
    175183
    176184add_action( 'admin_init', 'wpsh_admin_init' );
     185add_action( 'upgrader_process_complete', function() { add_option('wpsh_position','top'); });
    177186
    178187function wpsh_admin_init() {
     
    201210        add_option('wpsh_closable','1');
    202211    }
     212    if(!get_option('wpsh_position')){
     213        add_option('wpsh_position','top');
     214    }
    203215    if(!get_option('wpsh_content')){
    204216        add_option('wpsh_content','Thanks for using Sticky Header');
     
    214226    delete_option('wpsh_text_color');
    215227    delete_option('wpsh_closable');
     228    delete_option('wpsh_position');
    216229    delete_option('wpsh_content');
    217230}
Note: See TracChangeset for help on using the changeset viewer.