ACF Table Field Pro Add-on Docs Last updated:

Parent sources

On this page

Since version: v1.8.0

Release Candidate 1.8.0-RC1

This page documents version 1.8.0, which is available as Release Candidate 1.8.0-RC1 for manual installation. The current public version is 1.7.6, automatic plugin updates still deliver that version.

Download the Release Candidate from your account (Download the plugin) and install it manually (Install the plugin). Details may still change until the final release.

Filter acf_tablefield/formatting/nowrap_min_width

New since version 1.8.0

This filter is new.

This filter sets a minimum width for the formatting option no wrap. By default a cell with no wrap never wraps its text. With a minimum width, the cell wraps normally while the table container is narrower than that width, for example on small screens. Above that width the cell stays on one line.

No wrap is meant for short content. See Cell formatting.

Parameters

add_filter( 'acf_tablefield/formatting/nowrap_min_width', function( $min_width, $field, $post_id ) { 
 
	return '600px'; 
}, 10, 3 );
    • $min_width
    • (null|int|float|string)
    • The minimum width. Default null: no wrap applies always. A number greater than 0 is taken as pixels. A string must be a number with the unit px, em or rem, for example 600px, 40em or 37.5rem. Everything else is the same as null.

    • $field
    • (array|null)
    • The ACF field. null if the table is output from raw table data without a field.

    • $post_id
    • (int|string|false)
    • The post ID as passed to get_table(), false for the current post.

Result

<div class="acftf-table-container" data-acftf-nowrap-min="600px"><table> … </table></div>

Output

If a minimum width is set, the table is output inside a container, but only if at least one cell has no wrap. The plugin adds a rule to the stylesheet that lets the no-wrap cells wrap while the container is narrower than the minimum width.

The container is an additional element around the table. Theme CSS that depends on the element structure, for example .entry-content > table, no longer matches the table.

The container is not used if the formatting is output as inline styles, see acf_tablefield/formatting/inline_styles. No wrap then always applies. If the filter acf_tablefield/formatting/enqueue_style returns false, the rule for the minimum width is not output and your theme has to style the container itself.

Previous and Next Sources

Parent sources