'enable', 'content_selector' => '#main', 'post_class_selector' => '.post', 'navigation_selector' => '.posts-navigation', 'button_label' => 'Load More.', 'loading_message' => 'Loading...', 'finished_message' => 'No more posts available.' ); $bkker_get_option = get_option( 'ajax_load_more_by_bkker_theme_option_name', $default_option ); $bkker_get_option = wp_parse_args( $bkker_get_option , $default_option ); $enable_ajax_load_more = $bkker_get_option['enable_ajax_load_more']; global $wp_query; if( !is_singular() && $enable_ajax_load_more === 'enable' ) { wp_enqueue_style( 'ajax-load-more-by-bkker-theme', plugin_dir_url( __FILE__ ) . 'css/ajax-load-more-by-bkker-theme.css', array(), '1.0.0', 'all' ); wp_enqueue_script( 'ajax-load-more-by-bkker-theme', plugin_dir_url( __FILE__ ) . 'js/ajax-load-more-by-bkker-theme.js', array( 'jquery' ), '1.0.0', true ); $max_num_pages = $wp_query->max_num_pages; $page_next = ( get_query_var( 'paged' ) > 1 ) ? get_query_var( 'paged' ) + 1 : 2; $content_selector = $bkker_get_option['content_selector']; $post_class_selector = $bkker_get_option['post_class_selector']; $navigation_selector = $bkker_get_option['navigation_selector']; $button_label = $bkker_get_option['button_label']; $loading_message = $bkker_get_option['loading_message']; $finished_message = $bkker_get_option['finished_message']; wp_localize_script( 'ajax-load-more-by-bkker-theme', 'ajax_load_more', array( 'pageLink' => get_pagenum_link( PHP_INT_MAX ), 'pageMax' => $max_num_pages, 'pageNext' => $page_next, 'contentSelector' => $content_selector, 'postClassSelector' => $post_class_selector, 'navigationSelector'=> $navigation_selector, 'buttonLabel' => $button_label, 'loadingMessage' => $loading_message, 'finishedMessage' => $finished_message ) ); } } public function ajax_load_more_by_bkker_theme_add_plugin_page() { add_menu_page( __( 'AJAX Load More By BKKER Theme', 'bkker' ), __( 'AJAX Load More', 'bkker' ), 'manage_options', 'ajax-load-more-by-bkker-theme', array( $this, 'ajax_load_more_by_bkker_theme_create_admin_page' ), 'dashicons-schedule', 100 ); } public function ajax_load_more_by_bkker_theme_create_admin_page() { $this->bkker_get_option = get_option( 'ajax_load_more_by_bkker_theme_option_name' ); ?>

The BKKER Theme.

bkker_get_option['enable_ajax_load_more'] ) && $this->bkker_get_option['enable_ajax_load_more'] === 'enable' ) ? 'checked' : 'checked' ; ?>
bkker_get_option['enable_ajax_load_more'] ) && $this->bkker_get_option['enable_ajax_load_more'] === 'disable' ) ? 'checked' : '' ; ?>
', isset( $this->bkker_get_option['content_selector'] ) ? esc_attr( $this->bkker_get_option['content_selector']) : '#main' ); } public function post_class_selector_callback() { printf( '', isset( $this->bkker_get_option['post_class_selector'] ) ? esc_attr( $this->bkker_get_option['post_class_selector']) : '.post' ); } public function navigation_selector_callback() { printf( '', isset( $this->bkker_get_option['navigation_selector'] ) ? esc_attr( $this->bkker_get_option['navigation_selector']) : '.posts-navigation' ); } public function button_label_callback() { printf( '', isset( $this->bkker_get_option['button_label'] ) ? esc_attr( $this->bkker_get_option['button_label']) : esc_html__( 'Load More.', 'bkker' ) ); } public function loading_message_callback() { printf( '', isset( $this->bkker_get_option['loading_message'] ) ? esc_attr( $this->bkker_get_option['loading_message']) : esc_html__( 'Loading...', 'bkker' ) ); } public function finished_message_callback() { printf( '', isset( $this->bkker_get_option['finished_message'] ) ? esc_attr( $this->bkker_get_option['finished_message']) : esc_html__( 'No more posts available.', 'bkker' ) ); } } new Ajax_Load_More_By_Bkker_Theme();