Ok, so somehow I got it working by changing it to this:
It looks like it didn’t like ‘the_clientId’. Maybe it just doesn’t like capital letters????
[insert-form form_location="form.php" identification_number="12345"]
function insert_the_form($atts){
$form_base = plugin_dir_path(__DIR__);
// Shortcode attributes & options
$atts = shortcode_atts(
array(
'form_location' => 'NULL',
'identification_number' => 'NULL' //Variable for client ID
), $atts, 'insert_the_form'
);
if ( isset($atts['form_location']) ){
$form_location = $atts['form_location'];
}
if ( isset($atts['identification_number']) ){
$form_idnumber = $atts['identification_number'];
}
$clientId = $form_idnumber;
ob_start();
include($form_base . 'forms/' . $form_location);
$out = ob_get_clean();
return $out;
}
add_shortcode( 'insert-form', 'insert_the_form' );
Related Posts:
- ob_get_clean returns empty string, ob_get_flush outputs string
- where to include a php file
- Get value from shortcode to do something
- Create a WordPress shortcode using PHP [duplicate]
- Creating WordPress Shortcode with Variable
- How to put a form with php code into a variable or shortcode?
- Shortcode to include PHP file, pass various parameters to include?
- How to manually fix the WordPress gallery code using PHP in functions.php?
- Encode text string being appended as query to URL [closed]
- Where to get information about array fields in $_REQUEST?
- Include files in functions.php
- Variables declared in header not available in other includes
- Display a text message if the shortcode is not found?
- How to return a string that has a variable inside in a shortcode?
- Cleanest/Fastest way to avoid calling and retrieving data from the database multiple times?
- Run shortcode at certain resolution
- Passing a shortcode attribute to a sub-function
- post meta value as shortcode parameter
- Loading page template into shortcode
- How to add Shortcode (font awesome) in widget title?
- Can I change a variable in a content part while calling it?
- When would you use $_post instead of $post?
- the_author() not working outside the loop
- Autogenerate shortcodes from an array of strings
- How to Insert Shortcodes into Theme?
- Put CSS inside a PHP file and include it the right way
- is_page “range” for if statement?
- How can I generate random numbers inside my shortcodes on each implementation?
- How to rewrite URL with PHP variables with htaccess to a normal looking URL?
- Custom Theme, Custom shortcode not working
- Why is file_get_contents returning page source?
- Plugin CSS not enqueing
- Different loop output every x posts in custom post type
- Showing content from one page on another
- Showing a different gallery in a seperate post
- How can I Add a variable PHP in the Menu Nav
- Create own WordPress shortcode gallery
- WordPress Shortcodes.. printf is outputting a random number… Can’t figure out WHY?
- code is skipping a div
- How to use wp_add_inline_style for custom CSS added via shortcode?
- PHP, Creating a dynamic variable
- Displaying recent posts on static page with template-part via shortcode
- Excecuting php function in shortcode
- Correct and safe way to include php content in my page
- Variable not staying set
- Returning data instead of echoing/printing
- List taxonomy term slugs within shortcode (do_shortcode)
- do_action(), iFrame Gets Displayed Despite Password Protection [closed]
- Using Shortcode to Grab Archive Listing, Separate by Year
- php include not working in custom page
- Apply class to every third list item? [duplicate]
- How to deal with too many $_POST variable conditions from ajax request at backend? [closed]
- List all blogs, but exclude the main site
- How to pass a variable to get_template_part that’s updated every time the template part is called?
- Insert page content into another page with a changed variable
- How to access or parse key/values that have “string”
- Shortcode to pull posts
- PHP code inside Shortcode
- Help Fallback (thumbnail)
- How to return a string that has a jQuery and Ajax inside in a shortcode?
- Action Hook Inside WordPress Plugin Shortcode
- How can I include the user id inside of a shortcode php output?
- PHP Helper Class to create shortcodes
- how can I include some custom variable from functions.php?
- Change Spaces to Dashes?
- WordPress is removing query variables like page, p from the URL of a custom static page
- Updating Metadata with Shortcode
- using shortcodes inside gravity forms
- How to Create custom block for displaying information in content section which act like shortcode
- Create shortcode for metabox gallery
- Can’t pass var from php wp_ajax into ajax script : result undefined or null
- Custom global variable not working in function
- couldnt show short code atts in category
- Advanced Custom Forms PHP formatting for do_shortcode
- overwrite wordpress gallery with custom gallery shortcode
- How do I fix Undefined variable using $_POST in function?
- How to use Contact Form 7 shortcode value in a page?
- How Can I Display the Last Modified Date for User Profiles on WordPress?
- Show products per shortcode
- How do I fetch a data from an external database into my wordpress homepage
- Open/closed function [closed]
- What is wrong with this shortcode? to include external php file in WordPress posts
- Need to Echo A Url path to show on a wordpress page
- Where can I find the declaration of `$_wp_theme_features`?
- Child theme functions.php file change database entries
- Formatting Shortcode to Display in Visual Mode
- How to pass parameter that ends up being part of a class name with wordpress shortcode
- How do I / Is it possible to execute an external PHP file / function inside WordPress?
- Overwriting a Shortcode
- How to include a php file in every post and page [duplicate]
- A next page function with shortcode?
- wordpress.org disallowing my plugin becuase of loading core files in cron cpanel file
- using a shortcode in a hyperlink
- Use ajax response in PHP function
- WP Custom tables query
- Display total count of products in orders of a specific order status
- Gutenberg – render_callback does not pass ToggleControl value on frontend
- HTTP 500 Error after Creating Shortcode
- How call WordPress shortcode inside function file
- How to execute a shortcode within a custom field?