I have 2 custom post types, project
and person
. Both have several custom fields.
I'm working on a template for the project
custom post type.
In the project
custom fields I have several fields of type relation, as seen in this screenshot. Unfortunately I don't really undestand what they mean and how to use them, but that is not my main question.
Next, inside the person
custom fields, I have only text fields, like first_name
, last_name
, etc.
Now let's say I have one custom post type of type person
. That person has contributed to a project, which is a custom post type of type project
.
How can I now, when working on the template of the project
posts, include an [acf field] shortcode to a custom field of type person
?
Here is a screenshot/concept of what I want to do: Circled in red are information pulled from the project
custom fields, whereas circled in blue are information pulled from the person
custom fields.
Notes:
I'm fairly new to wordpress and have no knowledge in php
Ideally a solution to my problem should not need me to add code to php files as that is not desired by my client. Preferably it should be doable inside the WPBakery template editor.
- Installed and usable plugins are ACF, WPBakery, toolset, salient, acf-vc, custom post type UI
Thank you for your help, I hope I succeeded to phrase my problem in an understandable manner.
UPDATE
I found this plugin, which seems to do provide one solution: nested shortcodes: https://wordpress.org/plugins/nested-shortcodes/
Unfortunately, it also poses constraints, and has not allowed me to find a solution. What I want to do is this:
Input: [acf field="first_name" post_id=[acf field="student"]]
With the expected output being: John Doe
Unfortunately the output I get is: ]
Which according to them is partly due to shortcode limitations listed here https://codex.wordpress.org/Shortcode_API#Limitations
On the other hand, this hardcoded workaround works:
Input: [acf field="student"]
Output: 89
Input: [acf field="first_name" post_id=89]
Output: John Doe
Unfortunately this workaround has the hardcoded unique ID 89, which makes it thus unable to use as a template for future usage.
Does anyone have a solution or better workaround that does not necessite me to hardcode? I'm also open for completely new ideas and directions, as long as it helps me solve this problem