Plugin Directory

Changeset 3110212


Ignore:
Timestamp:
07/01/2024 07:23:39 AM (21 months ago)
Author:
latifpala
Message:

Tested upto latest WP version

Location:
sticky-on-scroll
Files:
6 added
6 edited

Legend:

Unmodified
Added
Removed
  • sticky-on-scroll/trunk/admin/stsc-admin-settings.php

    r1725379 r3110212  
    11<?php
    2 function stsc_register_settings() {
    3    add_option( 'stsc_Elements', '');
    4    add_option( 'stsc_min_screen', '480');
    5    register_setting( 'stsc_options_group', 'stsc_Elements', 'stsc_Settings_callback' );
    6    register_setting( 'stsc_options_group', 'stsc_min_screen', 'stsc_Settings_callback' );
     2if ( ! function_exists( 'stsc_register_settings' ) ) {
     3  function stsc_register_settings() {
     4    add_option( 'stsc_Elements', '');
     5    add_option( 'stsc_min_screen', '480');
     6    register_setting( 'stsc_options_group', 'stsc_Elements', 'stsc_Settings_callback' );
     7    register_setting( 'stsc_options_group', 'stsc_min_screen', 'stsc_Settings_callback' );
     8  }
     9  add_action( 'admin_init', 'stsc_register_settings' );
    710}
    8 add_action( 'admin_init', 'stsc_register_settings' );
    911
    10 function stsc_register_options_page() {
    11   add_options_page('Sticky on Scroll', 'Sticky on Scroll', 'manage_options', 'stsc_register_options_page', 'stsc_options_page');
     12if ( ! function_exists( 'stsc_register_options_page' ) ) {
     13  function stsc_register_options_page() {
     14    add_options_page(__('Sticky on Scroll', 'sticky-scroll'), __('Sticky on Scroll', 'sticky-scroll'), 'manage_options', 'stsc_register_options_page', 'stsc_options_page');
     15  }
     16  add_action('admin_menu', 'stsc_register_options_page');
    1217}
    13 add_action('admin_menu', 'stsc_register_options_page');
    1418
    15 function stsc_options_page()
    16 {
    17 ?>
    18   <div class="stsc-form">
    19   <?php screen_icon(); ?>
    20   <form method="post" action="options.php">
    21   <?php settings_fields( 'stsc_options_group' ); ?>
    22   <h2><?php echo __('Sticky on Scroll', 'sticky-scroll'); ?></h2>
    23   <p><?php echo __('You can pick any element that you want to stick on top of the page when you scroll down. It can be used for navigation menus or any element that you want as sticky.', 'sticky-scroll'); ?></p>
    24   <table>
    25   <tr valign="top">
    26   <th scope="row"><label for="stsc_Elements"><?php echo __('Sticky Element','sticky-scroll'); ?></label></th>
    27   <td><input type="text" id="stsc_Elements" name="stsc_Elements" value="<?php echo get_option('stsc_Elements'); ?>" /> <?php echo __('(eg. #navigation, header, section, .sticky-section)', 'sticky-scroll'); ?></td>
    28   </tr>
    29 
    30   <tr valign="top">
    31   <th scope="row"><label for="stsc_min_screen"><?php echo __('Minimum screen size to set elements sticky.','sticky-scroll'); ?></label></th>
    32   <td><input type="text" id="stsc_min_screen" name="stsc_min_screen" value="<?php echo get_option('stsc_min_screen'); ?>" /> <?php echo __('pixels','sticky-scroll'); ?></td>
    33   </tr>
    34 
    35   </table>
    36   <?php  submit_button(); ?>
    37   </form>
    38   </div>
    39 <?php
    40 } ?>
     19if ( ! function_exists( 'stsc_options_page' ) ) {
     20  function stsc_options_page(){ ?>
     21    <div class="stsc-form">
     22      <form method="post" action="options.php">
     23        <?php settings_fields( 'stsc_options_group' ); ?>
     24        <h2><?php echo __('Sticky on Scroll', 'sticky-scroll'); ?></h2>
     25        <p><?php echo __('You can pick any element that you want to stick on top of the page when you scroll down. It can be used for navigation menus or any element that you want as sticky.', 'sticky-scroll'); ?></p>
     26        <table>
     27          <tr valign="top">
     28            <th scope="row"><label for="stsc_Elements"><?php echo __('Sticky Element (ID or Class)','sticky-scroll'); ?></label></th>
     29            <td><input type="text" id="stsc_Elements" name="stsc_Elements" value="<?php echo get_option('stsc_Elements'); ?>" /> <br /><?php echo __('(eg. #navigation, header, section, .sticky-section)', 'sticky-scroll'); ?></td>
     30          </tr>
     31          <tr><td colspan="2">&nbsp;</td></tr>
     32          <tr valign="top">
     33            <th scope="row"><label for="stsc_min_screen"><?php echo __('Minimum screen size to set elements sticky.','sticky-scroll'); ?></label></th>
     34            <td><input type="text" id="stsc_min_screen" name="stsc_min_screen" value="<?php echo get_option('stsc_min_screen'); ?>" /> <?php echo __('pixels','sticky-scroll'); ?></td>
     35          </tr>
     36        </table>
     37        <?php  submit_button(); ?>
     38      </form>
     39    </div>
     40  <?php
     41  }
     42}
  • sticky-on-scroll/trunk/assets/css/stsc-admin-style.css

    r1725379 r3110212  
    11.stsc-form table th{
    22    text-align:left;
    3     width:30%;
     3    width:40%;
     4}
     5.stsc-form table th label{
     6    font-size: 16px;
     7}
     8.stsc-form table td input{
     9    width: 90%;
    410}
    511.stsc-form h2{
  • sticky-on-scroll/trunk/assets/js/jquery.custom.js

    r1729194 r3110212  
    1 jQuery(document).ready(function($) {
    2        
    3     var current_width = jQuery(window).width();
    4    
    5     if(SS_obj.selectors!='' &&  current_width > SS_obj.width){
    6         jQuery(SS_obj.selectors).stopAtTop();
    7     }
    8 
    9 });
     1(function($) {
     2    jQuery(document).ready(function($) {
     3        var current_width = jQuery(window).width();
     4        if(SS_obj.selectors!='' &&  current_width > SS_obj.width){
     5            jQuery(SS_obj.selectors).stopAtTop();
     6        }
     7    });
     8})(jQuery);
  • sticky-on-scroll/trunk/readme.txt

    r1729194 r3110212  
    22Contributors: latifpala
    33Tags: sticky, navigation, header, menu, sticky header, sticky menu
    4 Requires at least: 3.5
    5 Tested up to: 4.8.1
     4Requires at least: 5.0
     5Tested up to: 6.5.5
    66Stable tag: 1.0
    77License: GPLv2 or later
     
    5050= 1.0.1 =
    5151Alert bug fixed.
     52
     53= 2.0.0 =
     54Translation Added
     55Tested upto new WP Version
     56Minor bugs fixed
  • sticky-on-scroll/trunk/sticky-on-scroll.php

    r1729194 r3110212  
    33Plugin Name: Sticky on Scroll
    44Description: You can pick any element that you want to stick on top of the page when you scroll down. It can be used for navigation menus or any element that you want as sticky.
    5 Version: 1.0.1
     5Version: 2.0.0
     6Requires at least: 5.2
     7Requires PHP:      7.2
     8License:           GPL v2 or later
     9License URI:       https://www.gnu.org/licenses/gpl-2.0.html
    610Author: Latif Pala
    711Author URI: https://profiles.wordpress.org/latifpala
     12Domain Path:       /languages
    813Text Domain: sticky-scroll
    914*/
     
    1116
    1217define('STSC_ROOT', plugin_dir_path(__FILE__));
    13 
    14 function stsc_uninstall(){
    15     delete_option( 'stsc_Elements' );
    16     delete_option( 'stsc_min_screen' );
    17 }
    18 register_uninstall_hook( __FILE__, 'stsc_uninstall' );
    1918
    2019function stsc_load_custom_scripts($hook) {
     
    4443add_action('admin_enqueue_scripts', 'stsc_load_admin_custom_scripts');
    4544
     45add_action( 'init', 'stsc_load_textdomain' );
     46function stsc_load_textdomain() {
     47    load_plugin_textdomain( 'sticky-scroll', false, dirname( plugin_basename( __FILE__ ) ) . '/languages' );
     48}
    4649require dirname( __FILE__ ) . '/admin/stsc-admin-settings.php';
Note: See TracChangeset for help on using the changeset viewer.