Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Shabti Kaplan

    (@shabti)

    Hello,

    I can try to help you with this. What data do you need to show in the relationship field?

    Thread Starter vasanth

    (@vasant84kumar)

    Hi Shabti,

    I have Post Type Called food_menus and attached ACF filed called menu_price

    I have another post type called food_orders which customers chooses the menu from ACF relationship field Object from food_menus CPT

    I want the value of menu_price to be displayed adjacent with Title Name of food_menus in ACFfrontend and WPbackend food_orders form.

    View post on imgur.com

    View post on imgur.com

    I am not able to figure out how to do it. Thanks

    Plugin Author Shabti Kaplan

    (@shabti)

    function add_meta_field_to_acf_relation($title, $post, $field, $post_id){
        return str_replace('</div>', '</div> <strong>'.get_field('menu_price',$post->ID).': </strong>', $title);
    }
    add_filter('acf/fields/relationship/result', 'add_meta_field_to_acf_relation',10,4);

    This should work

    Thread Starter vasanth

    (@vasant84kumar)

    Hi Shabti,

    Thank You so much it worked.

    Plugin Author Shabti Kaplan

    (@shabti)

    My pleasure

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Additional metal value in frontend relationship field’ is closed to new replies.