I have two post types lets say X and Y. Now I am going to create PDF files from Y which Parent is X and I want to use fields which are stored in X. The Posttypes have a (X) 1:n (Y) relationship.
I think I can create a function which takes the post ID as a parameter and returns the fields and than call this function via shortcode in the template builder? Is it possible and if how?
* where [e2pdf-wp key="metakey2" meta="true"] must output the Post ID from which you need to get the data, it can also be as: [e2pdf-wp key="post_parent"], or any other shortcode, etc.
P.S. Keep attention please that if the same element/object has another [e2pdf-wp] shortcodes in "Value", shortcodes must be closed, as: [e2pdf-wp key="ID"][/e2pdf-wp]
We would really appreciate your feedback at WordPress.org!
but nothing is outputted. Is there also a Debug option somehow?
5 May, 2024 06:09:59
E2Pdf
Support
Topics: 7
Messages: 3335
[e2pdf-wp key="post-id-of-X" meta="true"] - must output the Post ID, where post-id-of-X is a META KEY that stores the ID of the X post in the Y post. It must not be set to Post ID.
If you need to get data from the "static" post, just by the known ID, the shortcode will be just simple:
If you still need to find out from the relation, you need to find which shortcode outputs the ID of the X post and put that code in the middle of the shortcode with the id="dynamic", for example if "X" is a parent post of "Y":
We would really appreciate your feedback at WordPress.org!
5 May, 2024 06:46:35
lukashwm
Topics: 2
Messages: 10
Well, that's exactly how I understood the codes.
But even [e2pdf-wp id="123" key="wpcf-custom-field-slug-from-X" meta="true"] does not output anything. The other field from actual posts are working fine.
In the end I need it dynamic but I can store the related post id of X in a Y field that's not a problem.
The Post types are different is that a problem? But they are both abstractions of typical Wordpress Posts which also support get_post_meta()
curious...
5 May, 2024 06:49:49
E2Pdf
Support
Topics: 7
Messages: 3335
No, it must not be a problem. It could be that you are using an incorrect meta key. Can you please create an E2Pdf template connected to the X post type and check via "Visual Mapper" which meta keys are available by part of the key that you are trying to use?
We would really appreciate your feedback at WordPress.org!
5 May, 2024 06:57:30
lukashwm
Topics: 2
Messages: 10
Did it, but nothing.
This is out Template for X provided by the plugin:
[e2pdf-wp key="wpcf-sl-kunde" meta="true"]
This is what I used in my original Template for Y:
[e2pdf-wp id="dynamic" key="wpcf-sl-kunde" meta="true"][e2pdf-wp key="10004" meta="true"][/e2pdf-wp]
Where 10004 is the id of a random post of type X with value in field: "wpcf-sl-kunde"
5 May, 2024 06:59:42
E2Pdf
Support
Topics: 7
Messages: 3335
[e2pdf-wp key="10004" meta="true"] - will output nothing, as 10004 is the Post ID and not the Meta Key. Incorrectly used shortcode.
[e2pdf-wp id="10004" key="wpcf-sl-kunde" meta="true"] - must output your value.
[e2pdf-wp id="dynamic" key="wpcf-sl-kunde" meta="true"]10004[/e2pdf-wp] - must output your value.
We would really appreciate your feedback at WordPress.org!
5 May, 2024 07:09:31
lukashwm
Topics: 2
Messages: 10
Sorry but [e2pdf-wp id="10004" key="wpcf-sl-kunde" meta="true"] and [e2pdf-wp id="dynamic" key="wpcf-sl-kunde" meta="true"]10004[/e2pdf-wp] are outputting nothing. See attached screenshots.
5 May, 2024 07:19:02
E2Pdf
Support
Topics: 7
Messages: 3335
Is that field created with ACF?
Can you please attach the screenshot with the field SL-Kunde setup? You can mark message private so only we can see the message.
P.S. We also recommend doing checks with the "textarea" object instead of the "HTML" object.
We would really appreciate your feedback at WordPress.org!
5 May, 2024 07:31:17
lukashwm
Topics: 2
Messages: 10
nah, it is created with Toolset (https://toolset.com/de/). And there is no critical information so it can stay public may be it helps others ;)
5 May, 2024 07:39:25
lukashwm
Topics: 2
Messages: 10
The system runs under PHP 8.3 FPM if thats may be important
5 May, 2024 07:44:25
E2Pdf
Support
Topics: 7
Messages: 3335
The setup looks correct and should work...
Can you please create a new "textarea" in the E2Pdf Template, with the same shortcode:
[e2pdf-wp id="10004" key="wpcf-sl-kunde" meta="true"] as value.
If it still won't work, unfortunately, we would need to take a look on your side directly. If it's acceptable for you, you can submit a support ticket with access details to the WP Admin Dashboard here: [private]
We would really appreciate your feedback at WordPress.org!
5 May, 2024 08:05:18
lukashwm
Topics: 2
Messages: 10
Well, new Text Area Field solved the problem. Jeeesus :D damn technology...
Also the dynamic option does work !
Awesome guys ! Really appreciate your response time thats absolutely incredible as also the plugin is !!!!!!!!!!!
Well played !
5 May, 2024 08:08:02
E2Pdf
Support
Topics: 7
Messages: 3335
It must also work with the HTML/Input object that you used. It seems you set some actions that were removing or hiding your "HTML" object with which you did tests, that's why it could not display anything, or the "value" was inserted malformed (Best way to set it is via "Right Mouse Click" -> "Properties" -> "Value")
We would really appreciate your feedback at WordPress.org!
We use tools, such as cookies, to enable essential services and functionality on our site and to collect data on how visitors interact with our site, products and services. By accepting cookies you are agreeing to our Cookie Policy.