• Hi!

    i need to change the column titles but ther is no option available. My columns are all in lowercase and doen’t allow space between words. I want my column names go from this “mes_nacimiento” to this “Mes de Nacimiento”. Sql doesn’t allowspaces or latin characters in the columns name. Can this plugin do that?

    Thanks in advance

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter webmasterjgb

    (@webmasterjgb)

    like i show in this image https://snag.gy/v2kQfe.jpg

    Plugin Author ka2

    (@ka2)

    Hi there,

    In that case, you should use a “cdbt_shortcode_custom_columns” filter.
    For example used as follows:

    
    function my_shortcode_custom_columns( $columns, $shortcode_name, $table ){
      if ( 'cdbt-view' === $shortcode_name && 'your_table_name' === $table ) {
        foreach ( $columns as $_i => $_column ) {
          switch ($_column['property']) {
            case 'mes_nacimiento':
              $columns[$_i]['label'] = 'Mes de Nacimiento';
              break;
            case 'mail': // <- target column name
              $columns[$_i]['label'] = 'Correo Electronico'; // <- displayed label
              break;
            case 'telefono': 
              $columns[$_i]['label'] = 'Telefono';
              break;
             
          }
        }
      }
      return $columns;
    }
    add_filter( 'cdbt_shortcode_custom_columns', 'my_shortcode_custom_columns', 10, 3 );
    

    Please try it, thank you.

    Thread Starter webmasterjgb

    (@webmasterjgb)

    It worked great!

    Thank you so much, your plugin is awesome. Keep up the good work ??

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Change column title’ is closed to new replies.