Added HTML table into a block. Duplicated the block as per normal Gutenberg controls but the newly duplicated block doesn’t show for some reason.
The block itself is there, but there is no table.
When I go back to the editor and refresh the page, the table is empty.
Hey,
Some of my data contains an HTML element in the form of a link, but it is not displayed on the frontend. Is there a way to display this data?
I am using a shortcode to display data from a table.
function shortcode_oteviraci_doba() {
$table = get_field('zkusebna');
if (!empty($table)) {
$output = '<table border="0">';
if (!empty($table['caption'])) {
$output .= '<caption>' . esc_html($table['caption']) . '</caption>';
}
if (!empty($table['header'])) {
$output .= '<thead><tr>';
foreach ($table['header'] as $th) {
$output .= '<th>' . esc_html($th['c']) . '</th>';
}
$output .= '</tr></thead>';
}
$output .= '<tbody>';
foreach ($table['body'] as $tr) {
$output .= '<tr>';
foreach ($tr as $td) {
$output .= '<td>' . esc_html($td['c']) . '</td>';
}
$output .= '</tr>';
}
$output .= '</tbody></table>';
return $output;
}
return '<p>No data available.</p>';
}
add_shortcode('oteviraci_doba', 'shortcode_oteviraci_doba');
Hello, when I add new rows, the rows are empty. I can’t insert any data.
Plugins I’m using:
Thanks for your help.
]]>The table doesn’t show up in the Gutenberg inspector controls when I select it in the content area.
After looking into it, I found that in in/js/input-v5.js
on line 155, the line t.ui_event_ajax();
was commented out.
When I removed the comments and ran that line, the table field appeared.
I’m not sure why this line was commented out, so it might cause some side effects, but I wanted to share as much information as possible.
Plugins I’m using:
Thank you!
]]>Hello, I would like to be able to integrate a button on a cell, with an external link. Is it possible to implement this integration, maybe via PHP?
Thank you for the support!
]]>Hi, are we getting first-party WPGraphQL support for Table fields?
Until then, this is what I’ve done:
add_action( 'wpgraphql/acf/registry_init', function() {
register_graphql_acf_field_type( 'table', [
'graphql_type' => 'Table',
'resolve' => function ($root, $args, $context, $info, $field_type, $field_config ) {
$value = $field_config->resolve_field($root, $args, $context, $info);
if (is_null($value)) {
return null;
}
error_log(print_r($value, true));
return [
'header' => 1 == $value['use_header'] ? array_map(function ($th) {
return $th['c'];
}, $value['header']) : [],
'body' => array_map(function ($row) {
return array_map(function ($cell) {
return $cell['c'];
}, $row);
}, $value['body'])
];
},
]);
});
// Add Table-Type
add_action('graphql_register_types', function () {
register_graphql_object_type('Table', [
'fields' => [
'header' => ['type' => ['list_of' => 'String']],
'body' => ['type' => ['list_of' => ['list_of' => 'String']]],
],
]);
});
]]>
Hi there,
I’m trying to edit this field using the WordPress REST-API, but get the error acf[table] ist nicht vom Typ string,null
This is the body of my POST
request:
{
"acf": {
"table": {
"use_header": true,
"header": [
{
"c": "Header Row 1 Col A"
},
{
"c": "Header Row 1 Col B"
}
],
"caption": false,
"body": [
[
{
"c": "Body Row 1 Col A"
},
{
"c": "Body Row 1 Col B"
}
],
[
{
"c": "Body Row 2 Col A"
},
{
"c": "Body Row 2 Col B"
}
]
]
}
}
}
How can I update the field using the REST-API?
]]>I got this error “, , , Array”. Can you help me fix it, please?
This is my table
Here is my shotcode [acf field=”table”]
]]>Hey, I am try to use your plugin to show tablefield in page which was builded with Elementor. But somehow, table didn’t appear… I am using all the latest version of Elementor and Advanced custom fields, also as Advanced Custom Fields: Table Field.
I added page link in which table should be but there is not.
Hi there!
I cannot update the data of the table. For instance, if I delete a row or a column and hit the update button in the gutenberg editor, it seems to be saved, however if I refresh the page being in the editor page, the table shows the old data, as if the rows or columns had never been deleted.
WordPress version: 6.4.3
ACF Pro version: 6.2.6.1
Plugin version: 1.3.21
Also tried with:
WordPress version: 6.4.2
ACF Pro version: 6.2.5
Plugin version: 1.3.21
Can you please tell us after the text below How can embed a YouTube video?
]]>When the table field is on an ACF options page https://www.advancedcustomfields.com/resources/options-page/
update_field does not work.
see also https://github.com/johannheyne/advanced-custom-fields-table-field/issues/10 although the thread there diverges a bit into updates and fixes that are not related strictly to options page.
see below a monkey patch to get this functionality working.
class-jh-acf-field-table.php in update_value function
function update_value( $value, $post_id, $field ) {
if ( is_string( $value ) ) {
$value = wp_unslash( $value );
$value = urldecode( $value );
$value = json_decode( $value, true );
}
// UPDATE via update_field() {
if (
isset( $value['header'] ) OR
isset( $value['body'] )
) {
// try post_meta
$data = get_post_meta( $post_id, $field['name'], true );
// try term_meta
if ( empty( $data ) ) {
$data = get_term_meta( str_replace('term_', '', $post_id ), $field['name'], true );
}
// begin monkey patch for options table
// error_log('acftf-monkeypatch.post_id' . json_encode($post_id));
// error_log('acftf-monkeypatch.field[name]' . json_encode($field['name']));
//try options
if ( empty( $data ) AND
( $post_id = 'options' OR
$post_id = 'option'
)
)
{
$data = get_option('options_' . $field['name']);
// error_log('acftf-monkeypatch option data: ' . json_encode($data));
}
// end monkey patch
// prevents updating a field, thats data are not defined yet
]]>
This plugins show a warning on homepage, that is in not tested with 6.2 latest version.
Please let us know if there is any update release in recent month or it is still compatible with 6.2 version
]]>HI! I made a table and inserted it in the frontend with Elementor following the guide. Then I used WPML for site translations. In the backend the table is also copied in the second language as desired, but in the frontend it is displayed only in the main language. How can I display it also in the other languages ??and solve this problem?
]]>how to use with acf repeater , thanks
]]>I couldn’t see a roadmap, but is it possible in the future to duplicate the tables?
Thanks!
Hello. Is it possible to create e.g. 2 data values in one cell? Just like colspan in html. Thank you for your answer.
Example: https://www.w3schools.com/TAGS/tryit.asp?filename=tryhtml_th_colspan
]]>I am using the tinymce editor within the ACF editor not gutenberg and wondering if I can merge cells and add background color to the row?
]]>We have a problem on a customers site, where editing tables is broken in version 1.3.19.
The table does not show in the gutenberg inspector controls after selecting it in the content area.
The inspector controls only show the field label & description.
To me it looks like the new init() logic is flawed.
init_workflow() is never called, because the 4 loop passes are already over, when the table is selected in the content area.
May I know is it possible to adjust the column width within each post section?
If it is not possible, is it possible to make sure the column width is even in desktop regardless of number of columns?
For some reason, the column width is not aligned evenly in desktop. Mobile looks fine. Thanks so much for the help.
]]>Hi, can I know how can we display the table?
We set up a table field in our product page design with beaver builder. We need to create custom table information in different products.
However, unlike the normal acf fields, we are unable to see “table” under the field type. ie. the table option in the field type is missing.
I have attached the screen shot as below, can someone help? Thanks.
]]>Hello.
I use lastest version of plugin. I was hoping the last update would fix my problem, but no.
The table does not appear in the editor. When I click preview mode and then edit mode, it is visible. Unfortunately not before. Here is a video with an example of the situation.
https://youtu.be/L9Vg02wTE7g
In console just:
error: OPTIONS 405 wp-json/wp/v2/pages/1317?_locale=user 405 api-fetch.min.js?ver=bc0029ca2c943aec5311:2
Could you help me?
Hi Johann,
We’d update some modules and WP with ACF and Elementor today, but your Shortcode don’t work after update…
[tablefield field-name=”tablereferences” table-class=”my-table”]
it working before…
can you help me ?
Have a good day.
Jocelyn
Hi, how import the table static from site in the new site ?
]]>Hi , i have need to order the table with fist field in to letter A the Z
how i do?
]]>When I duplicate the post have the ACF table, it takes a lot of time to load the ACF table block in the duplicated post. I used Yoast Duplicate Post to duplicate the post.
Can you please check it?
Thanks!
]]>Hi! My team recently came across a bug due to how the new table field is registered.
Issue:
Currently, when the new field is registered to ACF, it registers it as a stdObject. If you inspect all the other fields, they are registered as their class type. Such as acf_field_text, acf_field_select, etc..
In your plugin you instantiate your class directly with: new acf_field_table();
This then calls the __constructor() method on the acf_field class, which then calls acf_register_field_type_info() which ends up creating the stdObject.
Fix:
This can be fixed by registering the plugin using the same function that the other fields are registered with:
acf_register_field_type( ‘acf_field_table’ );
This ACF function will register your field correctly and will be seen by ACF as an acf_field_table type.
Summary:
Can you please change the way you register the field by replacing:
new acf_field_table();
with:
acf_register_field_type( ‘acf_field_table’ );
Happy to go into further details if you would like.
Thanks!
Good morning, there is a way to give color styles to the table as the border color of the row
]]>I have created a duplicate of the page https://www.concoursosm.ca/ancients-laureats/
You can view it here
https://www.concoursosm.ca/ancients-laureats2
I want to merge cells that contain the same information, you can refer to the pdf on the first link.
How can I do this?
]]>Hi,
my setup:
– WordPress 6.x
– ACF Pro 6.0
– Polylang Pro
I am working with “Flexible Layouts” in ACF so i call the table data with get_sub_field("fieldname");
In PHP 7.4 it works without any problem. With PHP 8.0 or 8.1 the output of get_sub_field(“fieldname”); is absolute empty. I dont get any data with print_r();
What can I do?
Kind regards,
Tobias