Skip Navigation

[Resolved] sharing data from one post to others. They are siblings.

This support ticket is created 6 years ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 8:00 – 12:00 - -
13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 13:00 – 17:00 - -

Supporter timezone: America/New_York (GMT-04:00)

This topic contains 1 reply, has 2 voices.

Last updated by Christian Cox 6 years ago.

Assisted by: Christian Cox.

Author
Posts
#1180898

I have data that I'd like to enter only once into one post and then share it across all of it's siblings. In ACF you can display a field from one post on another based on post id. Is this possible? I'm working in php templates.

#1180935

Hi, if you know the related post's ID, then you can query its custom field values using standard Types field shortcodes or by using the types_render_field PHP API. Here is an example you can use to get started:

...
echo( types_render_field("my-number", array("style" => "FIELD_NAME : $ FIELD_VALUE", "id" => 12345)));
...

You can see that I've passed the style and id attributes into the arguments array. If you'd like to see more information about rendering custom field values with PHP, like the different attributes you can use, visit our documentation page here: https://toolset.com/documentation/customizing-sites-using-php/functions/
Click the orange "More info" button below any field type to see some examples with PHP and definitions for the supported attributes.

If you'd like to see more information about querying related posts, you can see our Post Relationships API documentation here: https://toolset.com/documentation/customizing-sites-using-php/post-relationships-api/