高级自定义字段 Link 按钮

Advanced Custom Fields Link Button

在此站点上:http://www.berkeleysg.com/ "Get a Quote" 按钮在 header.php 中硬编码如下:

$the_text = (get_sub_field('bsg_slide_text')) ? "<span class='caption   ".$options."'>".get_sub_field('bsg_slide_text')." <p style='text-align:center;'><a href='/contact/request-for-quote/' class='button'>Get a Quote</a></p></span>" : "";

我想用高级自定义字段替换该代码,但我是 ACF 的新手。

我创建了一个字段组,其中包含两个文本字段 - 一个用于标签,一个用于 link,但我对如何实现它有很多了解,但我找不到这方面的信息基本任务。

我终于明白了。我是 ACF 的新手,它看起来比实际更难。我必须将两个子字段添加到主页组,然后将模板代码更改为:

  if (get_field('bsg_slider')) { 
$count = 1;
echo "<div class='section' id='bsg-slider'>";
echo "<div class='cs cs-default' data-slider='isPag-on isPagNum-on' data-pagText='s.'>";

while( has_sub_field('bsg_slider') )      {
  $options = "";
  $img_options = "";

      $the_image = get_sub_field('bsg_slide_image');
      $the_image = $the_image[url];

      $the_bg_image = get_sub_field('bsg_slide_bg_image');
      $the_bg_image = $the_bg_image[url];

      $position = get_sub_field('bsg_image_position');


$the_text = (get_sub_field('bsg_slide_text')) ? "<span class='caption ".$options."'>".get_sub_field('bsg_slide_text')." <p style='text-align:center;'><a href='/contact/request-for-quote/' class='button'>Get a Quote</a></p></span>" : "";

至:

if (get_field('bsg_slider')) { 
$count = 1;
echo "<div class='section' id='bsg-slider'>";
echo "<div class='cs cs-default' data-slider='isPag-on isPagNum-on' data-pagText='s.'>";

while( has_sub_field('bsg_slider') )      {
  $options = "";
  $img_options = "";

      $the_image = get_sub_field('bsg_slide_image');
      $the_image = $the_image[url];

      $the_bg_image = get_sub_field('bsg_slide_bg_image');
      $the_bg_image = $the_bg_image[url];

      $position = get_sub_field('bsg_image_position');

      $quote_text= get_sub_field('quote_label');
      $quote_url= get_sub_field('quote_link');

 $the_text = (get_sub_field('bsg_slide_text')) ? "<span class='caption ".$options."'>".get_sub_field('bsg_slide_text')." <p style='text-align:center;'><a href=".get_sub_field('quote_link')." class='button'>".get_sub_field('quote_label')."</a></p></span>" : "";