一个 post 中多个外部 link 的 Wordpress 高级自定义字段外部 link 文本

Wordpress advanced custom fields external link text for multiple external links in one post

我在网站上使用 ACF 插件。假设在 post 中我想添加多个外部 link 并且我希望每个 link 都有一个可配置的显示文本而不是 permalink。使用 ACF 对单个外部 link 执行此操作并不难,但我无法弄清楚如何对同一个 post.[=13 上的多个外部 link 执行此操作=]

你应该看看 ACF 中继器 http://www.advancedcustomfields.com/resources/repeater/

它的意思是做你所描述的。 Repeater 字段充当 table 数据,您可以在其中定义列(子字段)并添加无限行。

<?php

//检查repeater字段是否有数据行 如果(have_rows('repeater_field_name')):

// loop through the rows of data
while ( have_rows('repeater_field_name') ) : the_row();

    // display a sub field value
    the_sub_field('sub_field_name');

endwhile;

其他:

// no rows found

endif;

?>