• Resolved Samara

    (@blouishhotmailcom)


    I am having the same issue as this user: https://wordpress.org/support/topic/hide-table-if-there-is-no-content?replies=4

    I see some one said it was fixed in a new update, however I am still having the same issue, the first cell is displaying even if it is empty. Am I missing something? I have added a custom header, but removing that does not solve the issue.

    $table = get_field( 'available_space' );
    if( $table) {
        echo '<table border="0">';?>
            <thead><tr><th>Suite</th><th>Sq. Ft.</th><th>Availability</th><th>Plan</th><th>Contact</th></tr></thead>
           <?php
            echo '<tbody>';
                foreach ( $table['body'] as $tr ) {
                    echo '<tr>';
                        foreach ( $tr as $td ) {
                            echo '<td>';
                                echo $td['c'];
                            echo '</td>';
                        }
                    echo '</tr>';
                }
            echo '</tbody>';
        echo '</table>';
    }
    else {
        echo 'For current availabilities, please use our Information Request form.';
    }

    https://wordpress.org/plugins/advanced-custom-fields-table-field/

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Johann Heyne

    (@jonua)

    The get_field() function returns only false if there is only 1 table body cell in the table and this cell is empty. It does not matter whether there is a header or not.

    Once multiple columns or rows exist, whether they are empty, get_field() returns the table data array.

    Thread Starter Samara

    (@blouishhotmailcom)

    Hi Johann,

    I understand this, however my fields are completely empty and a value is still showing. See picture.

    As you can see, a single cell is showing up.

    Plugin Author Johann Heyne

    (@jonua)

    Hello Samara,

    I can´t replicate that issue in an standard WordPress environment. Maybe the issue is a side effect in an rare situation. Can you give me please some more informations?
    – PHP Version
    – ACF Version
    – Browser Type and Version
    – WordPress Version
    – may other fields or content on that Template

    Thanks!
    Johann

    Thread Starter Samara

    (@blouishhotmailcom)

    Hi Johann,
    Sorry for the delay.

    PHP: 5.4
    ACF: Version 4.4.7
    ACF: Table Field: Version 1.1.8
    Browser: Google Chrome 49.0.2623.112
    Wordpress: 4.5
    Custom Fields on that template: Text, File, Table
    (Image of settings)

    Plugin Author Johann Heyne

    (@jonua)

    Thank you for the details. I fixed it with version 1.1.9

    Thanks for reporting that issue!

    Thread Starter Samara

    (@blouishhotmailcom)

    Working perfectly, thanks so much!

Viewing 6 replies - 1 through 6 (of 6 total)

The topic ‘Empty Table Showing’ is closed to new replies.