Title: Using an external shortcode with the CF plugin?
Last modified: May 30, 2023

---

# Using an external shortcode with the CF plugin?

 *  Resolved [davedw](https://wordpress.org/support/users/davedw/)
 * (@davedw)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/)
 * Hi,
 * I’ve managed to find a way of getting some of the data I was manually having 
   to update on the page as a variable, directly from an API and available as a 
   short code, wondering if you can help me get this working with CF please?
 * Current example of one of the variables is: [CP_CALCULATED_FIELDS_VAR name=”EDFGESRSC”
   value=”0.3605″] 
 * Ideally, I’d like to replace the value within value=”” with [code_snippet id=
   7 php format]
 * I’ve tried several ways of doing it, but with no success, is this something you
   can help me with please?
 * Thanks in advance!

Viewing 8 replies - 1 through 8 (of 8 total)

 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780361)
 * Hello [@davedw](https://wordpress.org/support/users/davedw/)
 * That’s not possible. WordPress does not allow inserting a shortcode into the 
   attributes of other shortcodes.
 * However, you can insert a script tag directly on your page’s content:
 *     ```wp-block-code
       <script>EDFGESRSC='[code_snippet id=7 php format]';</script>
       ```
   
 * WordPress includes the “Custom HTML” block to insert custom pieces of code.
 * Best regards.
 *  Thread Starter [davedw](https://wordpress.org/support/users/davedw/)
 * (@davedw)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780393)
 * Many thanks for the quick reply [@codepeople](https://wordpress.org/support/users/codepeople/)
 * Using custom HTML and putting in the above didn’t show me any errors, but the
   value didn’t get used in the form, does anything need to be done to tell it that
   it the CP_CALCULATED_FIELDS_VAR part?
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780433)
 * Hello [@davedw](https://wordpress.org/support/users/davedw/)
 * If the variable exists on the page, the plugin will use it. Please, indicate 
   the URL to the page that contains the variable to be sure your website generates
   it properly.
 * Best regards.
 *  Thread Starter [davedw](https://wordpress.org/support/users/davedw/)
 * (@davedw)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780470)
 * Hi [@codepeople](https://wordpress.org/support/users/codepeople/)
 * I’ve temp published my test page: [https://www.teslaev.co.uk/cost-to-charge-calc-2/](https://www.teslaev.co.uk/cost-to-charge-calc-2/)
 * The variable (which I can see in source) is: OctGoSpecial using the same format
   you specified above
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780494)
 * Hello [@davedw](https://wordpress.org/support/users/davedw/)
 * Please, take a look to your page’s source. The third-party shortcode is being
   replaced as follows:
 *     ```wp-block-code
       <script>OctGoSpecial='<p>16.401</p>
       ';</script>
       ```
   
 * It includes the value between p tags, and a carriage return before closing the
   text.
 * Please, look at the screenshot image below:
 * ![](https://i0.wp.com/resources.developers4web.com/cff/tmp/2023/05/30/hzPRfW6I2p.
   png?ssl=1)
 * Best regards.
 *  Thread Starter [davedw](https://wordpress.org/support/users/davedw/)
 * (@davedw)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780528)
 * Thanks again for your help [@codepeople](https://wordpress.org/support/users/codepeople/)–
   I know this is now out of the realms of your excellent plugin, but could the 
   theme be adding that?
 * In the code snippet, I’ve even set it to strip the output so it’s plain text 
   and it’s still doing it?
 *     ```wp-block-code
        // Capture the output without HTML tags
           ob_start();
           echo "{$unitRate}\n";
           $output = ob_get_clean();
   
           // Strip HTML tags from the captured output
           $output = strip_tags($output);
   
           // Display the output
           echo $output;
       ```
   
 *  Thread Starter [davedw](https://wordpress.org/support/users/davedw/)
 * (@davedw)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780736)
 * I’ve worked this out now [@codepeople](https://wordpress.org/support/users/codepeople/)
 * There was a formatting option on within code snippets and the <scripts> section
   should not have the ‘ for it to work.
 * Thanks for your help in getting me here!
 *  Plugin Author [codepeople](https://wordpress.org/support/users/codepeople/)
 * (@codepeople)
 * [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780748)
 * Hello [@davedw](https://wordpress.org/support/users/davedw/)
 * Excellent !!!!. Thank you very much for sharing your solution.
 * Best regards.

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Using an external shortcode with the CF plugin?’ is closed to new replies.

 * ![](https://ps.w.org/calculated-fields-form/assets/icon-256x256.jpg?rev=1734377)
 * [Calculated Fields Form](https://wordpress.org/plugins/calculated-fields-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/calculated-fields-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/calculated-fields-form/)
 * [Active Topics](https://wordpress.org/support/plugin/calculated-fields-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/calculated-fields-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/calculated-fields-form/reviews/)

 * 8 replies
 * 2 participants
 * Last reply from: [codepeople](https://wordpress.org/support/users/codepeople/)
 * Last activity: [3 years ago](https://wordpress.org/support/topic/using-an-external-shortcode-with-the-cf-plugin/#post-16780748)
 * Status: resolved