Plugin Directory

Changeset 2359297


Ignore:
Timestamp:
08/12/2020 06:11:26 PM (6 years ago)
Author:
maxsdesign
Message:

Added option to show the preloader just on the first visit

Location:
preloader-plus/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • preloader-plus/trunk/inc/customizer.php

    r1852333 r2359297  
    66            'elements'                  => apply_filters( 'preloader_plus_elements_default', array( 'icon', 'progress_bar' ) ),
    77            'show_on_front'             => false,
     8            'show_once'                 => false,
    89            'custom_content'            => '',
    910            'bg_color'                  => '#141414',
     
    128129    ) );
    129130
     131    $wp_customize->add_setting( 'preloader_plus_settings[show_once]', array(
     132        'type' => 'option',
     133        'capability' => 'edit_theme_options',
     134        'default' => $defaults['show_once'],
     135        'transport' => 'refresh',
     136        'sanitize_callback' => 'preloader_plus_sanitize_checkbox',
     137    ) );
     138
     139    $wp_customize->add_control( 'preloader_plus_settings[show_once]', array(
     140        'type' => 'checkbox',
     141        'section' => 'preloader_plus_settings',
     142            'label' => __( 'Show the preloader only on first visit', 'preloader-plus' ),
     143            'priority' => 10,
     144    ) );
     145
    130146    $wp_customize->add_setting( 'preloader_plus_settings[elements]', array(
    131147        'type'              => 'option',
  • preloader-plus/trunk/inc/preloader-plus.php

    r2333543 r2359297  
    6666        add_action( 'upload_mimes', array( $this, 'add_svg_mime' ) );
    6767        add_action( 'plugins_loaded', array( $this, 'load_textdomain' ) );
     68        add_action( 'init', array( $this, 'show_once' ) );
    6869
    6970        // Rate reminder actions.
     
    147148                preloader_plus_get_default()
    148149            );
    149             if( false !== $preloader_plus_settings['show_on_front'] && ! is_front_page() ) {
     150            if( ( false !== $preloader_plus_settings['show_on_front'] && ! is_front_page() ) || ( false !== $preloader_plus_settings['show_once'] && isset( $_COOKIE['show_preloader_once'] ) ) ) {
    150151                return;
    151152            }
     
    217218    }
    218219
     220    /**
     221     * Set a cookie to show the preloader once per session.
     222     *
     223     * @since 2.2
     224     */
     225     public function show_once() {
     226        $settings = $this->get_options();
     227        if( false !== $settings['show_once'] ) {
     228            if ( !isset( $_COOKIE['show_preloader_once'] ) ) {
     229                setcookie("show_preloader_once", 'show preloader once');
     230            }
     231            else {
     232                return;
     233            }
     234        }
     235    }
    219236
    220237    /**
     
    229246         // Get preloader options.
    230247        $settings = $this->get_options();
     248
     249        if( false !== $settings['show_once'] ) {
     250            if ( isset( $_COOKIE['show_preloader_once'] ) ) {
     251                return;
     252            }
     253        }
     254
     255        // Doesn't show the preloader if show on front is true and this is not the front page
    231256        if( false !== $settings['show_on_front'] && ! is_front_page() ) {
    232257            return;
  • preloader-plus/trunk/preloader-plus.php

    r2336697 r2359297  
    55Plugin URI: https://wordpress.org/plugins/preloader-plus/
    66Description: Add a page loading screen to your website with style and animations, easy to customize, works on all major browsers and with any theme, any device.
    7 Version: 2.1.2
     7Version: 2.2
    88Author: Massimo Sanfelice | Maxsdesign
    99Author URI: https://wp-brandtheme.com
     
    8686        public function set_plugin_version_constant() {
    8787            if ( ! defined( 'PRELOADER_PLUS_VERSION' ) ) {
    88                 define( 'PRELOADER_PLUS_VERSION', '2.1.2' );
     88                define( 'PRELOADER_PLUS_VERSION', '2.2' );
    8989            }
    9090        }
  • preloader-plus/trunk/readme.txt

    r2336697 r2359297  
    33Tags: preloader, page loader, loader, page loading, loading screen, page loading screen, loading page
    44Requires at least: 4.6
    5 Tested up to: 5.4
    6 Stable tag: 2.1.2
     5Tested up to: 5.5
     6Stable tag: 2.2
    77License: GPLv2 or later
    88License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    2525
    2626*   Show the preloader on every page or only on the front page.
     27*   Show the preloader only on the first visit.
    2728*   Add a custom image (jpg, png, gif, svg).
    2829*   Set animations and speed for your custom image.
     
    6768
    6869== Changelog ==
     70
     71= 2.2 =
     72
     73*Release Date: August 11, 2020*
     74
     75* Added option to show the preloader only on the first visit.
    6976
    7077= 2.1.2 =
Note: See TracChangeset for help on using the changeset viewer.