thejohnnyduke
Forum Replies Created
Viewing 2 replies - 1 through 2 (of 2 total)
-
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] get field echoing jsonHi Johann,
I’ve found the error. I’m using a local wp install but with an remote database (dev env). I forgot to sync the plugin folder…
In the admin area everything was ok (since I access it remotely), but testing locally, the wp installation didn’t find the plugin, hence the error…Sorry for the inconvenience, I need the weekend asap 😛
Thanks once again and keep up the great work!
Forum: Plugins
In reply to: [Table Field Add-on for ACF and SCF] get field echoing jsonHi Johann, thanks for the quick reply! 🙂
The code you provided outputted the correct array (as you wrote).
This is my complete code:
single-post page (inside the loop):
$product = new SG_products; $product->getProductRepeater('measurements', 'content_table', get_the_ID()));SG_products class:
public function getProductRepeater( $repeater_name, $field_name, $product_id ) { if ( have_rows( $repeater_name ) ) { $descriptions = array(); while ( have_rows( $repeater_name ) ) { the_row(); foreach (get_sub_field('taxonomy_association') as $taxonomy_group) { $descriptions[$taxonomy_group][$field_name] = $this->getTable( $field_name ); } } } return $descriptions; } private function getTable( $field_name ) { $field = get_sub_field($field_name); var_dump($field); $table = '<table>'; foreach ( $field['body'] as $tr ) { $table .= '<tr>'; foreach ( $tr as $td ) { $table .= '<td>'; $table .= $td['c']; $table .= '</td>'; } $table .= '</tr>'; } $table .= '</table>'; return $table; }The output of the var_dump is the json I wrote in the first post.
Any thoughts?Thanks for the help!
Viewing 2 replies - 1 through 2 (of 2 total)