Johann Heyne
Forum Replies Created
-
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Latest update broke tableHello gleenk,
I´m sorry about that issue, but I can´t replicate it. This may is an specific issue in a rare condition I can´t figure out without hands on.
Greetings,
JohannForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Table field in taxonomy term not showingSetting
t.var.ajax = true;always may have an performance impact. I investigated that issue in an taxonomy term edit page and may version 1.1.14 fix it.- This reply was modified 9 years, 3 months ago by Johann Heyne.
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] ArrayA table field returns an array that contains the table data. To render the array into an html table, please start with the code provided here.
- This reply was modified 9 years, 4 months ago by Johann Heyne. Reason: Fix typo
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] add table header data elsewhereAs fare as I can understand this solution and problem, the data-th attributes are missing. The following code shows how to put these attributes in the table html…
<?php $table = get_field( 'table' ); if ( $table ) { echo '<table border="0">'; if ( $table['header'] ) { echo '<thead>'; echo '<tr>'; foreach ( $table['header'] as $th ) { echo '<th>'; echo $th['c']; echo '</th>'; } echo '</tr>'; echo '</thead>'; } echo '<tbody>'; foreach ( $table['body'] as $tr ) { echo '<tr>'; foreach ( $tr as $i => $td ) { // get the table header content by column index echo '<td data-th="' . $table['header'][ $i ]['c'] . '">'; echo $td['c']; echo '</td>'; } echo '</tr>'; } echo '</tbody>'; echo '</table>'; } ?>- This reply was modified 9 years, 4 months ago by Johann Heyne. Reason: Better whitespace
- This reply was modified 9 years, 4 months ago by Johann Heyne. Reason: Wrap the code in code
- This reply was modified 9 years, 4 months ago by Johann Heyne. Reason: Fix typo
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] add table header data elsewhereHello,
Sorry, but I´m not sure, if I understand your question right. Could you please give an screenshot?
Thanks, Johann
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Fixed raw and colsHello,
thank you for the request. I appreciate that very much. I did this feature already and much more in a pro version of the plugin. But unfortunately it needs more time to finish and get it out to you. Tables have such a wide field of use case and I will provide a solid base for extending this plugin and its basic features with even more individuell features by other developers.
Cheers,
Johann- This reply was modified 9 years, 4 months ago by Johann Heyne.
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] ACF: Table Fields after update brokenThe reason showing all tables is maybe, that your WP_Query parameter does not exist and is ignored. So WP_Query returns all posts by default.
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] ACF: Table Fields after update brokenGet a single post with WP_Query:
https://codex.wordpress.org/Class_Reference/WP_Query#Post_.26_Page_ParametersForum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] ACF: Table Fields after update brokenTo get a single post by ID with WP_Query…
$the_query = new WP_Query( array( 'p' => 106 ) );And without WP_Query…
$post_id = 106; $table = get_field( 'speisekarte_tabelle', $post_id ); echo '<ul class="pplan">'; foreach( $table['body'] as $row => $key ) { echo '<li><span>' . $key[0]['c'] . '</span><div>' . $key[1]['c'] . '</div></li>'; } echo '</ul>';Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] ACF: Table Fields after update brokenHello,
whatever makes the different after the updates to trow that error, the problem may is the following. The error on line 97 perhaps is because
$keyin$key->{'0'}->cis not an object.$keyis an array. So the code should look like$key[0]->c.Anyway…
It is much easier to code using
get_field()…$table = get_field( 'speisekarte_tabelle' ); echo '<ul class="pplan">'; foreach( $table['body'] as $row => $key ) { echo '<li><span>' . $key[0]['c'] . '</span><div>' . $key[1]['c'] . '</div></li>'; } echo '</ul>';Hello, there is no useful way to implement an WYSIWYG Editor in this version of the plugin. But I´m working on a Pro version of the plugin, that already can use the WordPress Editor for editing a cells content. But there are more basic table features I´m still working on. You will get an message in the free version of the plugin, when the Pro version is available.
Thanks, Johann
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Sort bij descending?Hi, the plugin has no built in sorting functionality except by drag and drop manually. I´m working on a pro version with more functionality, but I´m not done yet. But here is a function you can use to sort by one or more columns:
function table_body_sort_by_columns() { $args = func_get_args(); $data = array_shift( $args ); foreach ( $args as $n => $field ) { if ( is_string( $field ) ) { $tmp = array(); foreach ( $data as $key => $row ) { $tmp[ $key ] = $row[ $field ]; $args[ $n ] = $tmp; } } } $args[] = &$data; call_user_func_array( 'array_multisort', $args ); return array_pop( $args ); }If you want to sort DESC by the first column:
$data = get_field( 'table' ); $data['body'] = table_body_sort_by_columns( $data['body'], '0', SORT_DESC );If you want to sort DESC by the second column:
$data = get_field( 'table' ); $data['body'] = table_body_sort_by_columns( $data['body'], '1', SORT_DESC );As you may have noticed, ‘0’ or ‘1’ identifies the index of the column to sort.
If you want to sort ASC by the first column and sort DESC by the second column:
$data = get_field( 'table' ); $data['body'] = table_body_sort_by_columns( $data['body'], '0', SORT_ASC, '1', SORT_DESC );Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Table Not Displaying CorrectlyHello,
The HTML is as it should. I think, the following styles in your stylesheet causing that frontend issue…// hides table rows 2,3,4,5 tbody tr:nth-of-type(2) { display: none; } tbody tr:nth-of-type(3) { display: none; } tbody tr:nth-of-type(4) { display: none; } tbody tr:nth-of-type(5) { display: none; } // hides the first cell of the 6. row tbody tr:nth-of-type(6) td:first-of-type { display: none; }Greetings,
Johann- This reply was modified 9 years, 8 months ago by Johann Heyne.
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Table field in taxonomy term not showingShould be working now in version 1.1.12.
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] Table field in taxonomy term not showingOk, I found an issue and I will fix it in the next release.