get_option('ald_wrapper_class'), 'load_selector' => get_option('ald_load_class'), 'visible_items' => get_option('ald_item_show'), 'load_items' => get_option('ald_item_load'), 'button_label' => get_option('ald_load_label'), 'display_type' => 'normal', ); } if ( get_option('ald_wrapper_classa') ) { $old_options['ald_wrapper_classa'] = array( 'btn_selector' => get_option('ald_wrapper_classa'), 'load_selector' => get_option('ald_load_classa'), 'visible_items' => get_option('ald_item_showa'), 'load_items' => get_option('ald_item_loada'), 'button_label' => get_option('ald_load_labela'), 'display_type' => 'normal', ); } if ( get_option('ald_wrapper_classb') ) { $old_options['ald_wrapper_classb'] = array( 'btn_selector' => get_option('ald_wrapper_classb'), 'load_selector' => get_option('ald_load_classb'), 'visible_items' => get_option('ald_item_showb'), 'load_items' => get_option('ald_item_loadb'), 'button_label' => get_option('ald_load_labelb'), 'display_type' => 'normal', ); } if ( get_option('ald_wrapper_classc') ) { $old_options['ald_wrapper_classc'] = array( 'btn_selector' => get_option('ald_wrapper_classc'), 'load_selector' => get_option('ald_load_classc'), 'visible_items' => get_option('ald_item_showc'), 'load_items' => get_option('ald_item_loadc'), 'button_label' => get_option('ald_load_labelc'), 'display_type' => 'normal', ); } if ( get_option('ald_wrapper_classd') ) { $old_options['ald_wrapper_classd'] = array( 'btn_selector' => get_option('ald_wrapper_classd'), 'load_selector' => get_option('ald_load_classd'), 'visible_items' => get_option('ald_item_showd'), 'load_items' => get_option('ald_item_loadd'), 'button_label' => get_option('ald_load_labeld'), 'display_type' => 'normal', ); } if ( get_option('ald_wrapper_classe') ) { $old_options['ald_wrapper_classe'] = array( 'btn_selector' => get_option('ald_wrapper_classe'), 'load_selector' => get_option('ald_load_classe'), 'visible_items' => get_option('ald_item_showe'), 'load_items' => get_option('ald_item_loade'), 'button_label' => get_option('ald_load_labele'), 'display_type' => 'flex', ); } // Get custom css from old options if ( get_option('asr_ald_css_class') ) { $old_options['custom_css'] = get_option('asr_ald_css_class'); } return $old_options; } // All old plugin options keys function ald_old_options_keys(){ $keys = array( 'ald_wrapper_class', 'ald_load_class', 'ald_item_show', 'ald_item_load', 'ald_load_label', 'ald_wrapper_classa', 'ald_load_classa', 'ald_item_showa', 'ald_item_loada', 'ald_load_labela', 'ald_wrapper_classb', 'ald_load_classb', 'ald_item_showb', 'ald_item_loadb', 'ald_load_labelb', 'ald_wrapper_classc', 'ald_load_classc', 'ald_item_showc', 'ald_item_loadc', 'ald_load_labelc', 'ald_wrapper_classd', 'ald_load_classd', 'ald_item_showd', 'ald_item_loadd', 'ald_load_labeld', 'ald_wrapper_classe', 'ald_load_classe', 'ald_item_showe', 'ald_item_loade', 'ald_load_labele', 'asr_ald_css_class', ); return $keys; } // Save & delete old plugin data function update_option_ald_options_hook( $old_value, $value, $option ){ // Save old plugin options in one array if ( ald_old_options() && get_option( 'ald_old_options' ) === false ) { update_option( 'ald_old_options', ald_old_options() ); } // Delete old plugin options if ( ald_old_options() ) { foreach ( ald_old_options_keys() as $key => $value ) { if( get_option( $value ) ){ delete_option( $value ); } } } // All done, Have fun! } add_action( "update_option_ald_options", "update_option_ald_options_hook", 10, 3 ); // Save option ajax add_action( 'wp_ajax_ald_save_settings', 'ald_save_option_ajax_function' ); function ald_save_option_ajax_function(){ // Check nonce if ( !isset( $_POST['ald_nonce'] ) || !wp_verify_nonce( $_POST['ald_nonce'], 'alma_settings_nonce' ) ) { wp_die('Permission Denied'); } // Check admin if ( !current_user_can( 'manage_options' ) ) { wp_die('Permission Denied'); } // Get options $options = isset( $_POST['ald_options'] ) ? $_POST['ald_options'] : array(); $options = apply_filters( 'ald_before_options_save', $options ); // Update entire array update_option('ald_options', $options); // Send success message wp_send_json_success(); die(); } // Add general wrapper action add_action( 'wp_ajax_ald_add_general_loadmore', 'ald_add_general_loadmore_action' ); function ald_add_general_loadmore_action(){ // Nonce check if ( !isset( $_POST['nonce'] ) || !wp_verify_nonce( $_POST['nonce'], 'lma-general-nonce' ) ) { wp_die('Permission Denied'); } $key = isset( $_POST['key'] ) ? sanitize_text_field( $_POST['key'] ) : ''; $thiskey = isset( $_POST['thiskey'] ) ? intval( $_POST['thiskey'] ) : 0; $output = ald_add_general_loadmore_wrap( array( 'key' => $key, 'thiskey' => $thiskey, ) ); echo $output; // phpcs:ignore die(); } // List of Display Types function ald_display_types(){ $types = [ 'default' => [ 'label' => 'Default', 'value' => 'default', 'pro' => false, ], 'flex' => [ 'label' => 'Flex', 'value' => 'flex', 'pro' => false, ], 'inline' => [ 'label' => 'Inline', 'value' => 'inline', 'pro' => true, ], 'block' => [ 'label' => 'Block', 'value' => 'block', 'pro' => true, ], 'contents' => [ 'label' => 'Contents', 'value' => 'contents', 'pro' => true, ], 'grid' => [ 'label' => 'Grid', 'value' => 'grid', 'pro' => true, ], 'inline-block' => [ 'label' => 'Inline Block', 'value' => 'inline-block', 'pro' => true, ], 'inline-flex' => [ 'label' => 'Inline Flex', 'value' => 'inline-flex', 'pro' => true, ], 'inline-grid' => [ 'label' => 'Inline Grid', 'value' => 'inline-grid', 'pro' => true, ], 'inline-table' => [ 'label' => 'Inline Table', 'value' => 'inline-table', 'pro' => true, ], 'list-item' => [ 'label' => 'List Item', 'value' => 'list-item', 'pro' => true, ], 'run-in' => [ 'label' => 'Run In', 'value' => 'run-in', 'pro' => true, ], 'table' => [ 'label' => 'Table', 'value' => 'table', 'pro' => true, ], 'table-caption' => [ 'label' => 'Table Caption', 'value' => 'table-caption', 'pro' => true, ], 'table-column-group' => [ 'label' => 'Table Column Group', 'value' => 'table-column-group', 'pro' => true, ], 'table-header-group' => [ 'label' => 'Table Header Group', 'value' => 'table-header-group', 'pro' => true, ], 'table-footer-group' => [ 'label' => 'Table Footer Group', 'value' => 'table-footer-group', 'pro' => true, ], 'table-row-group' => [ 'label' => 'Table Row Group', 'value' => 'table-row-group', 'pro' => true, ], 'table-cell' => [ 'label' => 'Table Cell', 'value' => 'table-cell', 'pro' => true, ], 'table-column' => [ 'label' => 'Table Column', 'value' => 'table-column', 'pro' => true, ], 'table-row' => [ 'label' => 'Table Row', 'value' => 'table-row', 'pro' => true, ], 'initial' => [ 'label' => 'Initial', 'value' => 'initial', 'pro' => true, ], 'inherit' => [ 'label' => 'Inherit', 'value' => 'inherit', 'pro' => true, ], ]; return $types; } // Single general loadmore data function ald_add_general_loadmore_wrap( $args ){ // Load Blank variable $btn_selector = $load_selector = $visible_items = $load_items = $button_label = $display_type = ''; // Parse incoming $args into an array and merge it with $defaults $args = wp_parse_args( $args, [ 'thiskey' => '', 'key' => '', 'selector' => array(), ] ); // Let's extract the array extract( $args['selector'] ); // Array key $key = isset( $args['key'] ) ? wp_generate_password(5, false) . sanitize_text_field( $args['key'] ) : wp_generate_password(5, false); if ( !isset( $args['selector']['wrapper_title'] ) ) { /* translators: %s: Number of the wrapper */ $wrapper_title = sprintf( __('Wrapper Title #%s', 'ajax-load-more-anything'), intval($args['thiskey']+1) ); } $load_more_button_wrapper = __( 'Load More Button Selector', 'ajax-load-more-anything' ); $load_more_button_wrapper_desc = __( 'Load more button will be insert end of this selector', 'ajax-load-more-anything' ); $load_more_item_selector = __( 'Load More Items Selector', 'ajax-load-more-anything' ); $load_more_item_selector_desc = __( 'Selector for load more items. Example: .parent_selector .items', 'ajax-load-more-anything' ); $visiable_items_text = __( 'Visible Items', 'ajax-load-more-anything' ); $visiable_items_desc = __( 'How many item will show initially', 'ajax-load-more-anything' ); $load_items_text = __( 'Load Items', 'ajax-load-more-anything' ); $load_items_desc = __( 'How Many Item Will Load When Click Load More Button?', 'ajax-load-more-anything' ); $button_label_text = __( 'Load More Button Label', 'ajax-load-more-anything' ); $button_label_desc = __( 'Enter the name of Load More Button
Use +[count] for countable button like +15 more', 'ajax-load-more-anything' ); ob_start(); do_action( 'ald_general_loadmore_before_wrap', $args ); ?>

×

$key, 'thiskey' => $key, ) ); echo $output; // phpcs:ignore die(); } // Single ajax loadmore data function ald_add_ajax_loadmore_wrap( $args ){ // Load Blank variable $event_type = $custom_button_append = $button_trigger_selector = $button_label = $click_selector = $hide_selector_wrapper = $wrapper_to_hide = $update_browser_url = $update_page_title = ''; // Parse incoming $args into an array and merge it with $defaults $args = wp_parse_args( $args, [ 'thiskey' => '', 'key' => '', 'selector' => [] ] ); // Let's extract the array extract( $args['selector'] ); // Selectors $selector = wp_parse_args( $args['selector'], [ 'trigger_offset' => 2000, ] ); // Array key $key = isset( $args['key'] ) ? $args['key'] : ""; if ( !isset( $args['selector']['wrapper_title'] ) ) { /* translators: %s: Number of the wrapper */ $wrapper_title = sprintf( __('Wrapper Title #%s', 'ajax-load-more-anything'), intval( $args['thiskey'] + 1 ) ); } // data_implement_selectors if ( !isset( $args['selector']['data_implement_selectors'] ) ) { $data_implement_selectors = array(); } $load_more_button_wrapper = __( 'Load More Button Selector', 'ajax-load-more-anything' ); $load_more_button_wrapper_desc = __( 'Load more button will be insert end of this selector', 'ajax-load-more-anything' ); $load_more_item_selector = __( 'Load More Items Selector', 'ajax-load-more-anything' ); $load_more_item_selector_desc = __( 'Selector for load more items. Example: .parent_selector .items', 'ajax-load-more-anything' ); $visiable_items_text = __( 'Visible Items', 'ajax-load-more-anything' ); $visiable_items_desc = __( 'How many item will show initially', 'ajax-load-more-anything' ); $load_items_text = __( 'Load Items', 'ajax-load-more-anything' ); $load_items_desc = __( 'How Many Item Will Load When Click Load More Button?', 'ajax-load-more-anything' ); $button_label_text = __( 'Load More Button Label', 'ajax-load-more-anything' ); $button_label_desc = __( 'Enter the name of Load More Button
Use +[count] for countable button like +15 more', 'ajax-load-more-anything' ); ob_start(); do_action( 'ald_ajax_loadmore_before_wrap', $args ); ?>

×

$value ) : $data_selector = isset( $value['data_selector'] ) ? $value['data_selector'] : ""; $implement_type = isset( $value['implement_type'] ) ? $value['implement_type'] : ""; if ( !$data_selector ) { continue; } ?>
− +
− +
− +

pro