This is an extension for the popular Advanced Custom Fields plugin and 高级自定义字段插件和https://wordpress.org/plugins/tablepress/">TablePress plugin.
https://wordpress.org/plugins/tablepress/">TablePress 插件。
By itself, this plugin does NOTHING.
本身,该插件没有任何作用。 strong> p>
This add-on for Advanced Custom Fields creates a custom field type to select a TablePress table, providing a dropdown menu that lets you select from a list of available tables.
此高级自定义字段加载项创建自定义字段类型以选择TablePress表,并提供一个下拉菜单,您可以从可用表列表中进行选择。
The field can return the table ID for the table selected, or the full HTML of the table.
该字段可以返回所选表的表ID或表的完整HTML。 p>
This plugin requires:
此插件要求: strong> p>- Advanced Custom Fields version 4+ or 5+
- 高级自定义字段版本4+或5 + li>
- TablePress version 1.5+
- TablePress 1.5及更高版本 li>
ul>
Just to be sure there's no confusion… This plugin does nothing unless ACF 请确保没有混乱… em> 该插件不会执行任何操作,除非 ACF (Or ACF Pro) and ACF Pro )和/plugins/tablepress/">TablePress
are both active on your site
/ plugins / tablepress /“> TablePress 在您的网站上均处于活动状态 strong> p>
Follow this plugin on GitHub
在 GitHub strong> p>上关注此插件Using the Field
使用字段 h3>
This field can return the table ID for the table selected, or the full HTML of the table (the same output as the rendered shortcode).
此字段可以返回所选表的表ID或表的完整HTML(与呈现的简码相同的输出)。 p>
When returning the table ID, either of the following code snippets will output your table (replacing ‘your_table_here’ with the field name you defined in your ACF Field Group settings).
返回表ID时,以下代码片段之一将输出您的表(将“ your_table_here”替换为您在ACF“字段组”设置中定义的字段名称)。 p>
<?php $tablepress_id = get_field( 'your_field_here' );
$ tablepress_id = get_field('your_field_here');
echo do_shortcode( '[table id="'.$tablepress_id.'"]' );
echo do_shortcode('[table id =“'。$ tablepress_id。'”]');
?>
?>
code> pre>
or, to avoid using do_shortcode()
, use
或者,为避免使用 do_shortcode() code>,请使用 p> <?php $tablepress_id = get_field( 'your_field_here' );
$ tablepress_id = get_field('your_field_here');
$args = array(
$ args =数组(
'id' => $tablepress_id,
'id'=> $ tablepress_id,
);
);
if ( function_exists( 'tablepress_print_table' ) ) {
如果(function_exists('tablepress_print_table')){
tablepress_print_table( $args );
tablepress_print_table($ args);
}
}
?>
?>
code> pre>
To simply display the chosen table on your page, choose the HTML output option in your field settings, and insert into your php with
要简单地在页面上显示所选表格,请在字段设置中选择HTML输出选项,然后使用 p>插入到您的php中
the_field( 'your_field_here' ); the_field('your_field_here');
code> pre>
For a more detailed explanation, see our article, Setting有关详细说明,请参见我们的文章设置up an ACF field for TablePress
.
设置TablePress的ACF字段
。 p>