Respuestas de foro creadas

Viendo 2 respuestas - 1 de 2 (de 2 total)
  • Pues todo el dilema fue por que no cerré un tag html en el código y hacia ese efecto de apilamiento, llevo una semana en esto y no lo había podido resolver hasta ahora, gracias de todas maneras

    bueno al parecer todas las cajas de los plugins están dentro de la meta box que hice por lo que produce la superposición, no me había fijado hasta ahora, si te fijas en la imagen esta el Yoast SEO y el caldera están haciendo ese efecto raro.

    <?php
    /*
    *
    * @thegrid
    * --CTP fuctions page
    *
    */
    
    /* custom post type */
    
    /*
      =======================
            The Grid
      =======================
    
    */
    
    add_action('init' , 'thegrid_grid_custom_post_type', 10);
    
    function thegrid_grid_custom_post_type()
    {
      $labels =  array(
        'name'                => 'Parrillas',
        'singular_name'       => 'Parrilla',
        'menu_name'           => 'Parrillas',
        'add_new'             => 'Añadir programa',
        'add_new_item'        => 'Añadir nuevo programa',
        'edit_item'           => 'Editar programa',
        'view_item'           => 'Ver programa',
        'all_items'           => 'Todos los Programas',
        'search_items'        => 'Buscar programa',
        'not_found'           => 'Programa no encontrado',
        'not_found_in_trahs'  => 'Programa no encontrado en la papela',
      );
    
      $rewrite = array(
        'slugs'       => 'grid',
        'with_front'  => true,
        'feeds'       => true,
        'pages'       => true
      );
    
      $args = array(
        'labels'          => $labels,
        'public'          => true,
        'show_ui'         => true,
        'show_in_menu'    => true,
        'query_var'       => true,
        'rewrite'         => $rewrite,
        'capabilities'        => array(
          'edit_post'          => 'update_core',
          'read_post'          => 'update_core',
          'delete_post'        => 'update_core',
          'edit_posts'         => 'update_core',
          'edit_others_posts'  => 'update_core',
          'delete_posts'       => 'update_core',
          'publish_posts'      => 'update_core',
          'read_private_posts' => 'update_core'
        ),
        'hierarchical'    => false,
        'menu_position'   => 24,
        'menu_icon'       => 'dashicons-grid-view',
        'supports'        => array( 'title', 'editor', 'thumbnail' )
      );//'capability_type' => 'post',
    
      register_post_type( 'grid', $args );
    
    }
    
    add_filter('manage_grid_posts_columns', 'thegrid_set_grid_columns', 10);
    add_action('manage_grid_posts_custom_column', 'thegrid_grid_custom_columns', 10, 2);
    
    function thegrid_set_grid_columns( $columns )
    {
      $newColumns = array();
      $newColumns['cb'] = 'cb';
      $newColumns['title'] = 'Programa';
      $newColumns['synopsis'] = 'Resumen';
      $newColumns['announcer'] = 'Presentador';
      $newColumns['transmition'] = 'Días';
      $newColumns['time'] = 'Hora';
      $newColumns['image'] = 'Imagen';
      //$newColumns['date'] = 'Date';
    
      return $newColumns;
    }
    
    function thegrid_grid_custom_columns( $column, $post_id )
    {
      switch ( $column ) {
          case 'synopsis':
            echo get_the_excerpt();
          break;
          case 'announcer':
               $announcer = esc_attr( get_post_meta( $post_id, 'thegrid_announcer', true) );
               echo $announcer;
          break;
          case 'image':
             $image = get_the_post_thumbnail_url($post_id);
             if ($image) {
               echo '<div style="width: 200px; height: 100px; background: url('.$image.') no-repeat top center; background-size: cover;"></div>';
             } else {
               echo 'No image selected.';
             }
          break;
          case 'time':
            $time = esc_attr( get_post_meta( $post_id, 'thegrid_time', true) );
            echo $time;
          break;
          case 'transmition':
            $days = array( 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo'  );
            $output = '';
            foreach ($days as $day) {
              $post_day = get_post_meta( $post_id, 'thegrid_'.strtolower($day) , true );
              if( $post_day == strtolower($day) ) {
                if ($output) $output .= ', ';
                $output .= $day;
              }
            }
            echo $output;
          break;
      }
    }
    
    add_action( 'add_meta_boxes' , 'thegrid_add_meta_box', 10 );
    
    function thegrid_add_meta_box()
    {
      add_meta_box( 'thegrid_multi_meta_box', 'Informaciòn de Programa', 'thegrid_multi_callback', 'grid' );
    }
    
    function thegrid_multi_callback( $post )
    {
    
      wp_nonce_field( basename(__FILE__), 'thegrid_multi_meta_nonce' );
    
      $thegrid_meta_fields = generator_meta_fields();
    
      echo '<table class="form-table">';
      foreach ( $thegrid_meta_fields as $field ) {
        $meta = get_post_meta( $post->ID, $field['id'], true);
    
        switch ($field['type']) {
          case 'text':
              echo '<label for="'. $field['id'] .'">'. $field['label'] . ' </label><input type="text" name="'. $field['id'] .'" id="'. $field['id'] .'" value="'. $meta .'" size="25" placeholder="'. $field['placeholder'] .'"/><hr>';
            break;
          case 'checkbox':
              echo '<input type="checkbox" name="'. $field['id'] .'" id="'. $field['id'] .'" value="'. $field['value'] .'" ', $meta ? ' checked' : '','/> <label for="'. $field['id'] .'">'. $field['label'] .' </label>';
            break;
          } //switch
      } //endforeach
      echo '<hr>';//endtable
    }
    
    add_action( 'save_post', 'thegrid_save_announcer_name_data', 10 );
    
    function thegrid_save_announcer_name_data( $post_id )
    {
    
      $thegrid_meta_fields = generator_meta_fields();
    
      if ( ! isset( $_POST['thegrid_multi_meta_nonce'] ) ) {
        return;
      }
    
      if ( ! wp_verify_nonce( $_POST['thegrid_multi_meta_nonce'] , basename(__File__) ) ) {
        return;
      }
    
      if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) {
        return;
      }
    
      if ( ! current_user_can( 'edit_post', $post_id ) ) {
        return;
      }
    
      foreach ( $thegrid_meta_fields as $field ) {
        $old = get_post_meta( $post_id, $field['id'], true );
        $new = $_POST[$field['id']];
        if ( $new && $new != $old ) {
          update_post_meta( $post_id, $field['id'], $new );
        } elseif ( '' == $new && $old ) {
          delete_post_meta( $post_id, $field['id'], $old );
        }
      }
    
    }
    
    /* Meta field generation */
    
    function generator_meta_fields()
    {
      $prefix = 'thegrid_';
      $announcer = array(
          array(
              'label' => 'Presentador',
              'id'    => $prefix.'announcer',
              'type'  => 'text',
              'placeholder' => 'Presentador'
          ),
          array(
            'label' => 'Horario',
            'id'    => $prefix.'time',
            'type'  => 'text',
            'placeholder' => 'Ejemplo: 18:00 - 19:00'
          )
      );
    
      $days = array( 'Lunes', 'Martes', 'Miercoles', 'Jueves', 'Viernes', 'Sabado', 'Domingo'  );
    
      foreach ( $days as $day ) {
      $check_box[] = array(
          'label' => $day,
          'id'    => $prefix.strtolower($day),
          'value' => strtolower($day),
          'type'  => 'checkbox'
      );
    
      }
    
      $output = array_merge($announcer, $check_box);
    
      return $output;
    }
    
    /* Grid end */
    
    add_action('do_meta_boxes', 'wpse33063_move_meta_box', 10);
    
    function wpse33063_move_meta_box(){
        //remove_meta_box( 'Caldera_Form_Grid', 'post', 'side' );
        //add_meta_box('postimagediv', __('Featured Image'), 'post_thumbnail_meta_box', 'post', 'normal', 'high');
    }
Viendo 2 respuestas - 1 de 2 (de 2 total)