Shortcode in HTML Object

6 March, 2019 06: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.
6 March, 2019 08:04:29
E2Pdf
Support
Topics: 7
Messages: 3163
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!
12 March, 2019 07:15:25
E2Pdf
Support
Topics: 7
Messages: 3163
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!