Plugin Directory

Changeset 2292927


Ignore:
Timestamp:
04/27/2020 07:06:38 PM (6 years ago)
Author:
atilbian
Message:

Version 1.0.3 : Shortcodes can now override globally defined progress bar

Location:
automatic-page-load-progress-bar/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • automatic-page-load-progress-bar/trunk/automatic-page-load-progress-bar.php

    r2292204 r2292927  
    1313 * Plugin URI:        https://gitlab.com/atilb/automatic-page-load-progress-bar-wordpress-plugin
    1414 * Description:       Add smooth and beautifull progress bar for your website. THX to : https://github.hubspot.com/pace/docs/welcome/#
    15  * Version:           1.0.2
     15 * Version:           1.0.3
    1616 * Author:            Arnaud TILBIAN
    1717 * Author URI:        https://www.arnaudtilbian.com
     
    3333
    3434function aplpb_hook_style_dynamic_content() {
    35     $drawGlobally = get_option( 'aplpb_option_checkbox ');
     35    $drawGlobally = get_option( 'aplpb_option_checkbox ');
    3636    if($drawGlobally == '1')
    3737    {
    38         aplpb_add_dynamic_content();
     38        $page_id = get_queried_object_id();
     39        $page_object = get_page( $page_id );
     40        if ( !has_shortcode($page_object->post_content, "aplpb_shortcode"))
     41        {
     42            aplpb_add_dynamic_content();
     43        }
    3944    }
    4045}
     
    4247function aplpb_add_dynamic_content($theme = NULL, $color = NULL) {
    4348    if($theme == NULL)
     49    {
    4450        $theme = get_option( 'aplpb_option_theme' );
     51    }
    4552    if($color == NULL)
     53    {
    4654        $color = get_option( 'aplpb_option_color' );
     55    }
    4756
    4857    wp_enqueue_style( $theme, plugins_url( 'public/css/' . $theme . '.css' , __FILE__ ), array(), false, false);
     
    105114                </tr>
    106115                <tr valign="top">
    107                     <th scope="row"><label for="aplpb_option_checkbox">Enable on all pages(shortcodes won't be active)</label></th>
     116                    <th scope="row"><label for="aplpb_option_checkbox">Enable on all pages(shortcodes can override it for page specfic loading bar)</label></th>
    108117                    <td>
    109118                        <input type="checkbox" id="aplpb_option_checkbox" name="aplpb_option_checkbox" value="1" <?php checked( get_option( 'aplpb_option_checkbox' ), '1' ); ?>/>
     
    128137        'color' => 'red'
    129138    ), $atts);
    130     $drawGlobally = get_option( 'aplpb_option_checkbox ');
    131     if($drawGlobally != '1')
    132     {
    133         aplpb_add_javascript();
    134         aplpb_add_dynamic_content(esc_html( $a['theme'] ), esc_html( $a['color'] ));
    135     }
     139   
     140    aplpb_add_javascript();
     141    aplpb_add_dynamic_content(esc_html( $a['theme'] ), esc_html( $a['color'] ));
    136142}
    137143add_shortcode( 'aplpb_shortcode', 'aplpb_shortcode');
  • automatic-page-load-progress-bar/trunk/readme.txt

    r2292204 r2292927  
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
    1010
    11 Embed beautifull loading bar on your wordpress website in just a few clics.
     11Embed beautiful loading bar on your wordpress website in just a few clics.
    1212
    1313== Description ==
     
    2121
    2222
    23 Shortcode give you a way to add specific shortcode for each page.
     23Shortcode give you a way to add specific shortcode for each page. It will override the globally defined progress bar .
    2424Example of use:
    2525[aplpb_shortcode theme="minimal" color="blue"]
     
    56562. Choose color and theme
    57573. Examples of loading screen/bar/wheel
     584. Example of shortcode use
    5859
    5960== Changelog ==
    60  
     61
     62 = 1.0.3 =
     63* Shortcodes can now override globally defined progress bar
     64
    6165= 1.0.2 =
    6266* Shortcode functionnality added
Note: See TracChangeset for help on using the changeset viewer.