I am trying to display a variable inside the PDF template ($PRODNUM). I have tried [e2pdf-view id="2" arg1="'.$PRODNUM.'"] with [e2pdf-arg key="arg1"] inside the template, but it only returns the string '.$PRODNUM.' . I have echoed the variable on the page outside the template, so I know there is data in the variable.
21 October, 2021 23:17:19
E2Pdf
Support
Topics: 7
Messages: 3574
Hi,
If you are trying to put this shortcode inside WordPress Page Content - unfortunately it will not work as PHP variables not available in this context.
You have 2 possible solutions:
1. Output the shortcode via PHP via custom hook / action / editing wordpress page template as:
2. If $PRODNUM can be retrieved by Page ID, you can use shortcode inside E2Pdf Template as:
[e2pdf-wp key="prodnum" meta="true"]
and PHP filter which must be added to your functions.php / PHP snippet, where you will add code which will get $PRODNUM by Page ID (if it's not $_POST / $_GET post data) :
We use cookies to collect and analyse information on site performance and usage, to provide social media features and to enhance and customise content and advertisements. By clicking "Accept Selected", you consent to use of selected cookies according our to our Cookie Policy.