'Where to display', 'id' => 'wheretodisplay', 'type' => 'select', 'options' => array( 'between_the_content' =>'Between the content', 'after_the_content' => 'After the content', 'before_the_content' => 'Before the content', 'ad_shortcode' => 'Ad Shortcode', ), ), array( 'label' => 'Position', 'id' => 'adposition', 'type' => 'select', 'options' => array( '50_of_the_content'=>'50% of the content', 'number_of_paragraph'=>'Number of paragraph', ), ), array( 'label' => 'Paragraph', 'id' => 'paragraph_number', 'type' => 'number', ), array( 'label' => 'Manual Ad', 'id' => 'manual_ads_type', 'type' => 'text', 'attributes' => array( 'readonly' => 'readonly', 'disabled' => 'disabled', 'class' => 'afw_manual_ads_type', ), ), ); public function __construct() { add_action( 'add_meta_boxes', array( $this, 'adsforwp_add_meta_boxes' ) ); add_action( 'save_post', array( $this, 'adsforwp_save_fields' ) ); } public function adsforwp_add_meta_boxes() { foreach ( $this->screen as $single_screen ) { add_meta_box( 'display', esc_html__( 'Display', 'ads-for-wp' ), array( $this, 'adsforwp_meta_box_callback' ), $single_screen, 'normal', 'low' ); } } public function adsforwp_meta_box_callback( $post ) { wp_nonce_field( 'adsforwp_display_data', 'adsforwp_display_nonce' ); $this->adsforwp_field_generator( $post ); } public function adsforwp_field_generator( $post ) { $output = ''; foreach ( $this->meta_fields as $meta_field ) { $attributes =''; $label = ''; $meta_value = get_post_meta( $post->ID, $meta_field['id'], true ); if ( empty( $meta_value ) ) { $meta_value = isset($meta_field['default']); } switch ( $meta_field['type'] ) { case 'select': $input = sprintf( ''; break; default: if(isset($meta_field['attributes'])){ foreach ( $meta_field['attributes'] as $key => $value ) { $attributes .= $key."=".'"'.$value.'"'.' '; } } $input = sprintf( '', $meta_field['type'] !== 'color' ? 'style="width: 100%"' : '', $meta_field['id'], $meta_field['id'], $meta_field['type'], $meta_value, $attributes ); } $output .= $this->adsforwp_format_rows( $label, $input ); } $common_function_obj = new adsforwp_admin_common_functions(); $allowed_html = $common_function_obj->adsforwp_expanded_allowed_tags(); echo '