Advertisement
semdev

plugin field cb

Apr 30th, 2019
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.62 KB | None | 0 0
  1.  
  2.         public function meteor_field_cb($fields){
  3.             foreach ( $fields as $field ) {
  4.  
  5.                 register_setting( $field['section'], $field['uid'] );
  6.                 $output = '<div class="meteor-plugin-options">';
  7.                 $output .= '<div class="meteor-option-label-div"><label for="' . $field['uid'] . '">' . $field['label'] . '</label></div>';
  8.  
  9.                 if ( $field['type'] === 'submit' ) {
  10.                     $output .= '<div class="meteor-option-input-div"><input type="submit" class="meteor-db-option-btn" name="' . $field['uid'] . '" id="' . $field['uid'] . '" value="'.$field['value'].'"> </div><p class="meteor-option-help">' . $field['helper'] . '</p>';
  11.                 }
  12.                 if ( $field['type'] === 'checkbox' ) {
  13.                     $output .= '<div class="meteor-option-input-div"><label class="toggle-check"><input class="toggle-check-input" type="checkbox" name="' . $field['uid'] . '" id="' . $field['uid'] . '"> <span class="toggle-check-text"></span></label></div><p class="meteor-option-help">' . $field['helper'] . '</p>';
  14.                 }
  15.                 if ( $field['type'] === 'text' ) {
  16.                     $output .= '<div class="meteor-option-input-div"><input type="text" name="' . $field['uid'] . '" id="' . $field['uid'] . '" value="' . $field['default'] . '"></div><p class="meteor-option-help">' . $field['helper'] . '</p>';
  17.                 }
  18.                 if ( $field['tool'] === true ) {
  19.                     $query_images_args = array(
  20.                         'post_type'      => 'attachment',
  21.                         'post_mime_type' => 'image',
  22.                         'post_status'    => 'inherit',
  23.                         'posts_per_page' => - 1,
  24.                     );
  25.                     $output            .= '<div class="meteor-images-wrap">';
  26.                     $query_images      = new WP_Query( $query_images_args );
  27.                     $images            = array();
  28.                     $output            .= '<div class="meteor-quick-actions"><a class="meteor-image-log meteor-btn" href="">View Full Log</a></div>';
  29.                     $output            .= '<div class="meteor-inner-title-holder"><h4 class="meteor-optimizer-inner--title">Image</h4><h4 class="meteor-optimizer-inner--title">URL</h4><h4 class="meteor-optimizer-inner--title">Reduction</h4></div>';
  30.                     foreach ( $query_images->posts as $image ) {
  31.                         $images[] = wp_get_attachment_url( $image->ID );
  32.  
  33.                         foreach ( $images as $image ) {
  34.                             $output .= '<div class="meteor-image-layout"><div class="meteor-inner-image-title"><img src="' . $image . '" alt="meteor image"></div><div class="meteor-inner-image-url"><a href="' . $image . '">' . $image . '</a> </div>';
  35.                             $output .= '<div class="meteor-inner-optimized-result"><h4 class="meteor-optimizer-inner-reduction-title">- 172Kb</h4></div>';
  36.  
  37.                             $output .= '</div>';
  38.                         }
  39.                     }
  40.                     $output .= '</div>';
  41.                 }
  42.                 $output .= '</div>';
  43.                 echo $output;
  44.             }
  45.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement