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/inline_styles

New since version 1.8.0

This filter is new.

This filter decides whether the formatting is also output as style attributes of the cells. This is for output that has no access to the stylesheet of the plugin, for example feeds, e-mails or PDF generators. By default it is on for feeds and off everywhere else.

The attribute data-acftf-format stays in the output. The style attribute is added to the cells that have formatting, with the properties vertical-align, text-align, font-weight, font-style, text-decoration, text-transform, font-size, white-space and font-variant. Text decoration and numbers use text-decoration and font-variant and not the longer properties text-decoration-line and font-variant-numeric, because WordPress removes them from attributes. No wrap always applies, there is no minimum width, see acf_tablefield/formatting/nowrap_min_width.

Parameters

add_filter( 'acf_tablefield/formatting/inline_styles', function( $enabled, $field, $post_id ) { 
 
	// inline styles for all tables, not only in feeds 
	return true; 
}, 10, 3 );
    • $enabled
    • (boolean)
    • Whether to output inline styles. Default is_feed().

    • $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

<td data-acftf-format="fw-700" style="font-weight: 700"></td>

Turn on for one call

add_filter( 'acf_tablefield/formatting/inline_styles', '__return_true' ); 
 
$html = get_table( 'my_table', $post_id ); 
 
remove_filter( 'acf_tablefield/formatting/inline_styles', '__return_true' );

Previous and Next Sources

Parent sources