Hi guys,
I currently have a requirement to insert shortcodes into a text field because each entry's shortcode needs modification.
Through a Google search, I found that ACF has a solution. The code is as follows:
<?php function my_acf_format_value( $value, $post_id, $field ) {
// Render shortcodes in all textarea values.
return do_shortcode( $value );
}
// Apply to all fields.
// add_filter('acf/format_value', 'my_acf_format_value', 10, 3);
// Apply to textarea fields.
add_filter('acf/format_value/type=textarea', 'my_acf_format_value', 10, 3);
How can I modify this code to allow the shortcode in Formidable text field, instead of being restricted to HTML field?
But I have limited programming experience, I need your assistance.
Thanks much,
Steven
function my_custom_shortcode_setup( $field, $values ) { if ( $field['id'] == 355 ) { $field_value = $values['default_value']; $field_value_with_shortcode = do_shortcode( $field_value ); $values['default_value'] = $field_value_with_shortcode; } return $values; } add_filter( 'frm_setup_new_fields_vars', 'my_custom_shortcode_setup', 20, 2 );Shortcode: [frm-pdf view=566 label="Download" entry_id="3582"] Is there anyone who can help me take a look at where I went wrong?
What do you want the result to be? Are you trying to display a link or button for someone to download a pdf? Why use a text field?
What you are doing is downloading the entire output from the view to be displayed in a text field. Not only is that the wrong way to do it, but I really don't understand the logic it. Please explain what the outcome is supposed to be.
Please login or Register to submit your answer