Title: Advanced Custom Fields: Table Field
Last modified: November 7, 2018

---

# Advanced Custom Fields: Table Field

 *  Resolved [haroldbier](https://wordpress.org/support/users/haroldbier/)
 * (@haroldbier)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/advanced-custom-fields-table-field/)
 * Hi
    I’m using Advanced Custom Fields: Table Field and I try to insert a table
   in single page, but the field doesn’t appear on the acf field key. I’m use it
   with the last version of Elementor, with Page Builder Framework and wordpress
   4.9.8 on a localhost with mamp
 * what is the solution
    thanks a lot

Viewing 1 replies (of 1 total)

 *  Plugin Author [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * (@jonua)
 * [7 years, 7 months ago](https://wordpress.org/support/topic/advanced-custom-fields-table-field/#post-10855834)
 * Hi,
 * in general, its up to Elementor to support ACF field types on the Elementor widgets.
   Under the link [https://docs.elementor.com/article/381-elementor-integration-with-acf](https://docs.elementor.com/article/381-elementor-integration-with-acf)
   you can see all supported ACF fields in Elementor for now. But because the table
   field is not a native ACF field, the support may never happen.
 * The way to go is using the Elementors shortcode Widget. Before you can use a 
   shortcode to display a table fields table, you have to setup a shortcode in functions.
   php. The following code does this. You can modify the table html output for your
   needs.
 *     ```
       function shortcode_acf_tablefield( $atts ) {
   
           $a = shortcode_atts( array(
               'field-name' => false,
               'post-id' => false,
           ), $atts );
   
           $table = get_field( $a['field-name'], $a['post-id'] );
   
           $return = '';
   
           if ( $table ) {
   
               $return .= '<table border="0">';
   
                   if ( $table['header'] ) {
   
                       $return .= '<thead>';
   
                           $return .= '<tr>';
   
                               foreach ( $table['header'] as $th ) {
   
                                   $return .= '<th>';
                                       $return .= $th['c'];
                                   $return .= '</th>';
                               }
   
                           $return .= '</tr>';
   
                       $return .= '</thead>';
                   }
   
                   $return .= '<tbody>';
   
                       foreach ( $table['body'] as $tr ) {
   
                           $return .= '<tr>';
   
                               foreach ( $tr as $td ) {
   
                                   $return .= '<td>';
                                       $return .= $td['c'];
                                   $return .= '</td>';
                               }
   
                           $return .= '</tr>';
                       }
   
                   $return .= '</tbody>';
   
               $return .= '</table>';
           }
   
           return $return;
       }
   
       add_shortcode( 'table', 'shortcode_acf_tablefield' );
       ```
   
 * Then use the shortcode in a Elementors shortcode widget like this, to **insert
   a table from the current page or post**…
    `[table field-name="your table field
   name"]`
 * You also can **insert a table from another page or post**…
    `[table field-name
   ="your table field name" post-id="123"]`
 * Or you can **insert a table from a ACF option page**…
    `[table field-name="your
   table field name" post-id="option"]`
 * Cheers,
    Johann
    -  This reply was modified 7 years, 7 months ago by [Johann Heyne](https://wordpress.org/support/users/jonua/).

Viewing 1 replies (of 1 total)

The topic ‘Advanced Custom Fields: Table Field’ is closed to new replies.

 * ![](https://ps.w.org/advanced-custom-fields-table-field/assets/icon-256x256.png?
   rev=1962986)
 * [Table Field Add-on for ACF and SCF](https://wordpress.org/plugins/advanced-custom-fields-table-field/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/advanced-custom-fields-table-field/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/)
 * [Active Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/advanced-custom-fields-table-field/reviews/)

 * 1 reply
 * 2 participants
 * Last reply from: [Johann Heyne](https://wordpress.org/support/users/jonua/)
 * Last activity: [7 years, 7 months ago](https://wordpress.org/support/topic/advanced-custom-fields-table-field/#post-10855834)
 * Status: resolved