Shortcode in HTML Object

March 06, 2019 14:06:23
webmaster7
Topics: 4
Messages: 7
I added a HTML Object to the PDF and wanted the contents to contain shortcodes. In some cases that works fine, but using formidable field shortcodes within a shortcode appears not to work as may be seen from the following:

The basic very simple shortcode used is:

add_shortcode('SC_test', 'sc_test');
function sc_test($atts){
$a = shortcode_atts( array('data' => 'hc2019'), $atts);
return $a['data'];
}

Then I added a HTML Object to the PDF and entered the following code in it:

[SC_test data="abcdef"]

[SC_test data="[955]"]

[SC_test data="abcdef"]

This results in the following output:

abcdef

hc2019"]

abcdef

I wander if this is the intended handling.
March 06, 2019 16:04:29
E2Pdf
Topics: 7
Messages: 3617
Support
Hi,

Unfortunately custom shortcodes with "formidable" values as attributes not yet supported directly.

We moved your thread to "Feature Requests" to add its support. As soon as "functionality" will be added we will update this thread with the process of adding such shortcodes.

P.S. As a custom solution you can try check "Formidable" documentation about custom shortcodes for example: frmpro_fields_replace_shortcodes

We remain at your service.

We would really appreciate your feedback at WordPress.org!
March 12, 2019 14:15:25
E2Pdf
Topics: 7
Messages: 3617
Support
Hi,

We just released an update (1.06.00) with "e2pdf_extension_render_shortcodes_tags" filter where it's possible to "whitelist" own shortcodes. One limitation that shortcode must have such structure: [SC_test][955][/SC_test]. If shortcode whitelisted with this "filter" - [955] will be rendered before [SC_test] shortcode fire.

An example of usage (functions.php):

add_filter('e2pdf_extension_render_shortcodes_tags', 'sc_allow_shortcodes', 30, 1);
function sc_allow_shortcodes($shortcodes) {
$shortcodes[] = 'SC_test';
return $shortcodes;
}


add_shortcode('SC_test', 'sc_test');
function sc_test($atts, $content = '') {
/*
* $content - contains already rendered value
*/
$content = str_replace('First', 'Last', $content);
return $content;
}

We remain at your service.

We would really appreciate your feedback at WordPress.org!
Get News and Updates
Our monthly newsletter keeps you in the loop, so you'll always be up to date with the latest news and updates about E2Pdf.
* You can update your email subscription preferences here.
All trademarks, service marks, trade names, product names, and logos appearing on this website are the property of their respective owners. The use of trademarks such as Formidable Forms®, Forminator Forms®, Gravity Forms®, JetFormBuilder®, WordPress®, WooCommerce®, WPForms® and others is solely for identification purposes (nominative use) and does not imply any affiliation, sponsorship, or endorsement by the respective trademark holders.
© 2017 - 2026, https://e2pdf.com

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 to our Cookie Policy.