bliss_loadmore_admin_notice(); } ?>

"; echo esc_html( __("Shortcode: do_shortcode('[ajax-loadmore-button]');", 'bl-scroll')); break; } } public function bliss_loadmore_setup_fields() { $fields = array( array( 'uid' => 'scroll_type', 'label' => __('Load More with?', 'bl-scroll'), 'section' => 'our_first_section', 'type' => 'select', 'options' => array( 'option1' => __('Infinite Scroll', 'bl-scroll'), 'option2' => __('Button', 'bl-scroll'), ), 'default' => array(__('Infinite Scroll', 'bl-scroll')), 'helper' => '', 'supplimental' => __('Select type of the blog post scrlling, if you select button then use the Shortcode.', 'bl-scroll'), ), array( 'uid' => 'loadmore_button_text', 'label' => __('Load More Button Text', 'bl-scroll'), 'section' => 'our_first_section', 'type' => 'text', 'placeholder' => __('Load More','bl-scroll'), 'helper' => '', 'default' => '', 'supplimental' => '', ), array( 'uid' => 'loadmore_button_bgcolor', 'label' => __('Button Background Color', 'bl-scroll'), 'section' => 'our_first_section', 'type' => 'color', 'default' => '#0073aa', 'helper' => '', 'supplimental' => '', ), array( 'uid' => 'loadmore_button_txtcolor', 'label' => __('Button Text Color', 'bl-scroll'), 'section' => 'our_first_section', 'type' => 'color', 'default' => '#ffffff', 'helper' => '', 'supplimental' => '', ), array( 'uid' => 'loadmore_main_selector', 'label' => __('Post Listing Main Selector', 'bl-scroll'), 'section' => 'our_first_section', 'type' => 'text', 'placeholder' => __('#main','bl-scroll'), 'helper' => '', 'default' => '', 'supplimental' => '<div id="main">
  <div class="post-list">
  <div class="post-list">
  <div class="post-list">
</div>', ), array( 'uid' => 'loadmore_class_selector', 'label' => __('Post Listing class Selector', 'bl-scroll'), 'section' => 'our_first_section', 'type' => 'text', 'placeholder' => __('.post-list','bl-scroll'), 'helper' => '', 'default' => '', 'supplimental' => '<div id="main">
  <div class="post-list">
  <div class="post-list">
  <div class="post-list">
</div>', ), array( 'uid' => 'loadmore_image', 'label' => 'Loading Image', 'section' => 'our_first_section', 'type' => 'media', 'default' => '', 'helper' => '', 'supplimental' => __('Add the loading image that show while scrolling','bl-scroll'), ) ); foreach( $fields as $field ){ add_settings_field( $field['uid'], $field['label'], array( $this, 'bliss_loadmore_field_callback' ), 'bliss_loadmore_admin_fields', $field['section'], $field ); register_setting( 'bliss_loadmore_admin_fields', $field['uid'] ); } } public function bliss_loadmore_field_callback( $arguments ) { $value = get_option( $arguments['uid'] ); if( ! $value ) { $value = $arguments['default']; } switch( $arguments['type'] ){ case 'text': case 'password': case 'number': printf( '', sanitize_text_field($arguments['uid']), $arguments['type'], $arguments['placeholder'], sanitize_text_field($value) ); break; case 'textarea': printf( '', sanitize_text_field($arguments['uid']), $arguments['placeholder'], sanitize_text_field($value) ); break; case 'select': case 'multiselect': if( ! empty ( $arguments['options'] ) && is_array( $arguments['options'] ) ){ $attributes = ''; $options_markup = ''; foreach( $arguments['options'] as $key => $label ){ $options_markup .= sprintf( '', $key, selected( $value[ array_search( $key, $value, true ) ], $key, false ), $label ); } if( $arguments['type'] === 'multiselect' ){ $attributes = ' multiple="multiple" '; } printf( '', sanitize_title($arguments['uid']), $attributes, $options_markup ); } break; case 'radio': case 'checkbox': if( ! empty ( $arguments['options'] ) && is_array( $arguments['options'] ) ){ $options_markup = ''; $iterator = 0; foreach( $arguments['options'] as $key => $label ){ $iterator++; $options_markup .= sprintf( '
', $arguments['uid'], $arguments['type'], $key, checked( $value[ array_search( $key, $value, true ) ], $key, false ), $label, $iterator ); } printf( '
%s
', $options_markup ); } break; case 'color': printf( '', $arguments['uid'], $arguments['type'], sanitize_hex_color($value) ); break; case 'media': $imgshow = ''; if($value) { $imgshow = ' bl-img-show'; } $options_markup = ''; $options_markup .= "
"; $options_markup .= ""; $options_markup .= ''; $options_markup .= ''; $options_markup .= ""; $options_markup .= "
"; printf( '
%s
', $options_markup ); break; } if( $helper = $arguments['helper'] ){ printf( ' %s', $helper ); } if( $supplimental = $arguments['supplimental'] ){ printf( '

%s

', $supplimental ); } } public function media_selector_print_scripts() { $my_saved_attachment_post_id = get_option( 'media_selector_attachment_id', 0 ); ?>