Plugin Directory

Changeset 2388921


Ignore:
Timestamp:
09/26/2020 03:03:45 PM (5 years ago)
Author:
atilbian
Message:

1.1.2 feature : custom post can now display the progress bar

Location:
automatic-page-load-progress-bar
Files:
20 added
2 edited

Legend:

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

    r2323884 r2388921  
    1313 * Plugin URI:        https://gitlab.com/atilb/automatic-page-load-progress-bar-wordpress-plugin
    1414 * Description:       Light and efficient extension to add a progress bar in less than a minute.
    15  * Version:           1.1.1
     15 * Version:           1.1.2
    1616 * Author:            Arnaud TILBIAN
    1717 * Author URI:        https://www.arnaudtilbian.com
     
    2121 
    2222function aplpb_hook_progress_bar_front_content($isShortcode = FALSE) {
    23     if( (get_post_type( get_the_ID() ) == 'page' && get_option("aplpb_option_checkbox_page") == '1') ||  (get_post_type( get_the_ID() ) == 'post' && get_option("aplpb_option_checkbox_post") == '1') )
     23    if( (get_post_type( get_the_ID() ) == 'page' && get_option("aplpb_option_checkbox_page") == '1') ||  (get_post_type( get_the_ID() ) == 'post' && get_option("aplpb_option_checkbox_post") == '1') || ( is_custom_post_type() ) && get_option("aplpb_option_checkbox_custom") == '1' )
    2424    {
    2525        $page_id = get_queried_object_id();
     
    3333}
    3434
     35// thx to https://wordpress.stackexchange.com/a/95906
     36function is_custom_post_type( $post = NULL )
     37{
     38    $all_custom_post_types = get_post_types( array ( '_builtin' => FALSE ) );
     39
     40    if ( empty ( $all_custom_post_types ) )
     41        return FALSE;
     42
     43    $custom_types      = array_keys( $all_custom_post_types );
     44    $current_post_type = get_post_type( $post );
     45
     46    if ( ! $current_post_type )
     47        return FALSE;
     48
     49    return in_array( $current_post_type, $custom_types );
     50}
     51
    3552function aplpb_hook_progress_bar_front_content_shortcode($theme = NULL, $color = NULL) {
    3653        aplpb_add_javascript();
     
    6885    add_option( 'aplpb_option_color', '#ffffff');
    6986    add_option( 'aplpb_option_checkbox_page', '1');
     87    add_option( 'aplpb_option_checkbox_custom', '1');
    7088    add_option( 'aplpb_option_checkbox_post', '1');
    7189    add_option( 'aplpb_option_query_desktop', '1');
     
    7593    register_setting( 'aplpb_options_group', 'aplpb_option_color' );
    7694    register_setting( 'aplpb_options_group', 'aplpb_option_checkbox_page' );
     95    register_setting( 'aplpb_options_group', 'aplpb_option_checkbox_custom' );
    7796    register_setting( 'aplpb_options_group', 'aplpb_option_checkbox_post' );
    7897    register_setting( 'aplpb_options_group', 'aplpb_option_query_desktop' );
     
    141160                            <label for="aplpb_option_checkbox_post">Enable on blog post</label>
    142161                        </p>
     162                        <p>
     163                            <input type="checkbox" id="aplpb_option_checkbox_custom" name="aplpb_option_checkbox_custom" value="1" <?php checked( get_option( 'aplpb_option_checkbox_custom' ), '1' ); ?>/>
     164                            <label for="aplpb_option_checkbox_custom">Enable on all custom post</label>
     165                        </p>
    143166                    </td>
    144167                </tr>
  • automatic-page-load-progress-bar/trunk/readme.txt

    r2323884 r2388921  
    55Requires at least: 3.0.1
    66Tested up to: 5.4
    7 Stable tag: 1.1.1
     7Stable tag: 1.1.2
    88License: GPLv2 or later
    99License URI: http://www.gnu.org/licenses/gpl-2.0.html
     
    5959
    6060== Changelog ==
     61= 1.1.2 =
     62* Custom post can now display the progress bar
     63
    6164= 1.1.1 =
    6265* Flat top theme added, and small optimization(css minifying)
Note: See TracChangeset for help on using the changeset viewer.