亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

在博客存檔頁面上顯示 ACF

在博客存檔頁面上顯示 ACF

PHP
動漫人物 2022-10-28 14:47:52
我需要在博客存檔頁面上顯示一些額外的信息,但無法對其進行編碼,因為其他人必須能夠編輯這些信息。我在此頁面上添加了一些自定義字段,但無法在實際頁面上顯示它們。有什么辦法可以解決這個問題?我的代碼:<div class="save_the_date">    <?php    if( have_rows('actiedagen') ):        while ( have_rows('actiedagen') ) : the_row();            the_sub_field('actiedagen_titel');            the_sub_field('actiedagen_datum');            the_sub_field('actiedagen_locatie');        endwhile;    else :    endif;    ?></div>
查看完整描述

1 回答

?
寶慕林4294392

TA貢獻2021條經驗 獲得超8個贊

您可以添加用于編輯這些字段的選項頁面:


if (function_exists('acf_add_options_page')) {


    acf_add_options_page(array(

        'page_title'     => 'Theme General Settings',

        'menu_title'    => 'Theme Settings',

        'menu_slug'     => 'theme-general-settings',

        'capability'    => 'edit_posts',

        'redirect'        => false

    ));

}

然后在此選項頁面上顯示此字段組。


至于顯示值,您需要像這樣添加第二個參數“option”:


    <?php

    if( have_rows('actiedagen', 'option') ):

        while ( have_rows('actiedagen', 'option') ) : the_row();

            the_sub_field('actiedagen_titel'); // no need to add option here

            the_sub_field('actiedagen_datum');

            the_sub_field('actiedagen_locatie');

        endwhile;

    else :


    endif;

    ?>


查看完整回答
反對 回復 2022-10-28
  • 1 回答
  • 0 關注
  • 112 瀏覽

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號