最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

plugins - ACF Fields are not showing up on Homepage

programmeradmin2浏览0评论

I want to Customize the Yith Plugin for which I want to add some custom fields with Existing fields. I am getting fields from ACF and adding them to an array ACF Fields are showing up in Yith Setting but only a few are showing up in the Homepage and other site pages.

function ta_yith_woo_compare($fields){      
    $acf_fields_groups = acf_get_fields(5258);
    $labels = array();
    foreach($acf_fields_groups as $grp)
    {
        $group_id = $grp['ID'];
        $sub_fields = $grp['sub_fields'];
        foreach($sub_fields as $fld){
            $labels[$fld['name']] = $fld['label'];
        }
    }

    $fields =$fields + $labels;
    return $fields;
}

I want to Customize the Yith Plugin for which I want to add some custom fields with Existing fields. I am getting fields from ACF and adding them to an array ACF Fields are showing up in Yith Setting but only a few are showing up in the Homepage and other site pages.

function ta_yith_woo_compare($fields){      
    $acf_fields_groups = acf_get_fields(5258);
    $labels = array();
    foreach($acf_fields_groups as $grp)
    {
        $group_id = $grp['ID'];
        $sub_fields = $grp['sub_fields'];
        foreach($sub_fields as $fld){
            $labels[$fld['name']] = $fld['label'];
        }
    }

    $fields =$fields + $labels;
    return $fields;
}
Share Improve this question asked Aug 7, 2020 at 6:12 Sheeraz AhmedSheeraz Ahmed 1
Add a comment  | 

1 Answer 1

Reset to default 0

I figure out this by changing the following code from compare.php in Yith Plugin.

<?php foreach ($fields as $field => $name) : ?>
<th>
    <?php if ($field != 'image') echo esc_html( $name); ?>
</th>
.
.
.

Changed to this =>

<?php foreach ($fields as $field => $name) : ?>
<th>
    <?php if ($field != 'image') echo esc_html( $field ); ?>
</th>
.
.
.
发布评论

评论列表(0)

  1. 暂无评论