猿问

>HTML / PHP / JS>更改特定页面上的页脚文本

我会尽量说清楚。信息: - 字压网站


该网站有2种语言希伯来语和英语。问题在于页脚。我有4行会说: - 地址: ..... - 电话: . ... - 传真: ... - 电子邮件: .....@...通讯社


现在这都是用希伯来语写的,我想当有人在看英文页面时,把它们改成英文。简而言之,一种定位页面ID的方法(假设页面ID为英语主页20,联系我们页面为30),我想定位这些页面页脚并将这些特定行更改为其他行。我也在使用 ACF 专业版。


从理论上讲,它将像这样工作:如果页面ID =到20 &30,请在页脚中更改文本。


如果有帮助,我可以给h4和ID。至于ACF,我可以制作新的,并称它们为address_en,并有英文地址。当然,如果有更好的方法,请告诉我。


我不知道该怎么做。


/* Some CSS not relavent */

  <footer id="footer">

    <div class="container">

      <div class="row">

        <div class="col-sm-6">

        // Some Code here not relavent

        </div>

          <div class="col-sm-4">

            <h4>כתובת: <?php the_field('address', 24); ?></h4>

            <h4>טלפון: <?php the_field('telephone', 24); ?></h4>

            <h4 >פקס:00-000-0000</h4>

            <h4>כתובת אימייל: <?php the_field('emailaddress', 24); ?></h4>

        </div>

        <div class="col-sm-2">

          // Something here not relavent

        </div>

        

      </div>

    </div><!-- container -->


  </footer>

        


慕妹3242003
浏览 92回答 1
1回答

慕森王

当您致电时,您将从ID为24的帖子中获得ACF字段。这可能不是您想要在页脚等全局元素中执行的操作。ACF有一个选项页面元素,可能更适合设置类似的东西。the_field('address', 24);如果你走那条路,你就是如果/那么的陈述会是这样的。<?php&nbsp;&nbsp; if (get_the_ID() != 20 || get_the_ID() != 30){&nbsp; &nbsp; &nbsp; the_field('address', 'option');&nbsp; &nbsp; } else {&nbsp; &nbsp; &nbsp; the_field('address_en', 'option');&nbsp; &nbsp; };?>
随时随地看视频慕课网APP
我要回答