Johann Heyne
Forum Replies Created
-
Hi,
the update to version 1.2.4 should solve that problem.
Thanks for reporting me that problem!
Cheers,
JohannForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Template Repeater Field with Table// check if the repeater field has rows of data if( have_rows('repeater_field_name') ): // loop through the rows of data while ( have_rows('repeater_field_name') ) : the_row(); // get a sub field value (table field) $table = sub_field('sub_field_name'); // use the “Output Table HTML” code with $table endwhile; else : // no rows found endif;- This reply was modified 7 years, 9 months ago by Johann Heyne.
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Compatible with ACF 5.7?Yes, the plugin is compatible width ACF Pro 5.7.
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Custom codeThe plugin itself provides no option to customise the table columns width. But you could use CSS to change the width of table columns…
width of the first column
[data-name="fieldname"] .acf-table-top-row > *:nth-child(2) { width: 10%; }width of the second column
[data-name="fieldname"] .acf-table-top-row > *:nth-child(3) { width: 40%; }- This reply was modified 7 years, 10 months ago by Johann Heyne.
- This reply was modified 7 years, 10 months ago by Johann Heyne.
- This reply was modified 7 years, 10 months ago by Johann Heyne.
- This reply was modified 7 years, 10 months ago by Johann Heyne.
Hi, If I understand the issue correctly, then the table field is actually not the right choice. A problem would be: The number of columns would have to be fixed so that the whole thing makes sense for the user, which is not possible. I think the Repater field (addon) https://www.advancedcustomfields.com/resources/repeater/ would be the right choice.
I hope I could help,
JohannForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Update table through RESTHi, I just released a new version 1.2.3, which supports the ACF update_field() function. I´m not sure if that fixes the issue you have.
Cheers,
JohannForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Update table through RESTHi, I understand the problem and I try to investigate this next week.
Thanks for reporting!
JohannHi, this type of error may happen, if you switched an existing field to type “table” or name a new table field like an previous field of another field type which data still exists.
Cheers,
JohannForum: Plugins
In reply to: [Shortcode Empty Paragraph Fix] Doesn’t work anymoreHi, the plugin still works with WordPress version 4.9.5. Please check, that no other plugin or code causes the problem.
Thanks,
JohannForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Feature Request: Rich TextI´m sorry, but I have no timeframe except that I will
wait for the Gutenberg switch of WordPress to be sure, everything is working well then.Cheers,
JohannForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Justify A from B in tableHi, sorry for the delay. I’m not sure what you meant. Could you please describe it a bit better? Is it something at the table field editor or a frontend thing?
Cheers,
JohannForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Showing tableHi,
the array holds the table data. You have to build the table html from that array in you theme template.
See https://wordpress.org/plugins/advanced-custom-fields-table-field/#description-header under “OUTPUT TABLE HTML”
Cheers,
Johann- This reply was modified 8 years, 1 month ago by Johann Heyne.
You’re welcome!
JohannForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Where add this codes?Hi flyingfox,
there is a way, to paste tables with a shortcode in a post. But this is not a default functionality of the plugin. You can integrate this yourself. Just keep reading.
First of all the explanation, why the ACF shortcode does not work for tables or other data driven fields. The ACF shortcode only works for simple text based values. It just returns the data like get_field(). For fields such as repeaters or tables, the content is provided as an array or object for further processing into HTML. So the implementation as HTML is something you have to do by your own.
First step to get a shortcode, that returns a HTML table. You need a function in your functions.php file to get the html by providing a tables data. The following code does that:
if ( ! function_exists( 'render_table' ) ) { function render_table( $data = false ) { $return = ''; if ( $data ) { $return .= '<table border="0">'; if ( isset( $data['header'] ) and is_array( $data['header'] ) ) { $return .= '<thead>'; $return .= '<tr>'; foreach ( $data['header'] as $th ) { $return .= '<th>'; $return .= $th['c']; $return .= '</th>'; } $return .= '</tr>'; $return .= '</thead>'; } $return .= '<tbody>'; if ( isset( $data['body'] ) ) { foreach ( $data['body'] as $tr ) { $return .= '<tr>'; foreach ( $tr as $td ) { $return .= '<td>'; $return .= $td['c']; $return .= '</td>'; } $return .= '</tr>'; } } $return .= '</tbody>'; $return .= '</table>'; } return $return; } }Change that code for your needs.
Second step. Lets provide a function that combines get_field() and render_table():
if ( ! function_exists( 'get_table' ) ) { function get_table( $name = false, $post_id = false ) { if ( ! function_exists( 'get_field' ) OR ! function_exists( 'render_table' ) ) { return; } if ( $name ) { $data = get_field( $name, $post_id, true ); return render_table( $data ); } } }Now you could use
<?php echo get_table( 'your_table_field_name' ); ?>in a template to output the tables html of a table field. You also could output a table fields html of another page by providing a post ID like<?php echo get_table( 'your_table_field_name', 123 ); ?>.The last step is to define a shortcode in functions.php, that uses the get_table() function…
function shortcode_acf_tablefield( $atts ) { $a = shortcode_atts( array( 'name' => false, 'post-id' => false, ), $atts ); return get_table( $a['name'], $a['post_id'] ); } add_shortcode( 'table', 'shortcode_acf_tablefield' );Now you can use the shortcode like
[table name="your_table_field_name"]or[table name="your_table_field_name" post_id="123"].Cheers,
Johann- This reply was modified 8 years, 3 months ago by Johann Heyne.
- This reply was modified 8 years, 3 months ago by Johann Heyne.
- This reply was modified 8 years, 3 months ago by Johann Heyne.
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Import / Export Tool for tables?Hi,
unfortunately there is no import/export tool yet. I tried https://github.com/Jeradin/acf-dynamic-table-field but with no success.
I´m still working on a pro version of that plugin, which will have import and export. But I can´t tell an release date.
Thanks,
Johann