Your core issue is that you pass value as globals but never declare them as such.
Generally speaking, “template parts” are useful when you want to give the ability to someone else to override them via a child theme or plugin, but if you are doing a “one off” theme, it is just better to write a function that generates the form and pass to it the relevant parameters instead of using global variables.
Related Posts:
- How to add a shortcode button to the TinyMCE editor?
- Pass PHP variable to javascript
- Custom media upload content for inserting custom post shortcode
- Checking if an attribute exists in a shortcode
- How to add custom content template part for a custom post type on main query using a plugin
- Page Templates from plugin not working after upgrading WP to 4.7 or upper version
- enqueue script only if it is not already enqueue
- Creating a default Custom Post Template that a Theme can override
- Enqueue style inside shortcode but its loaded at the bottom of page (before footer scripts)
- How To Ignore a Filter On Applying Filter the Content In a Function
- How can I add a custom header to a custom template in a plugin without using the theme folders
- Shortcode display outside the div
- Pass $this to function nested in another public function of the same class
- shortcode doesn’t work
- Custom url structure for custom template
- do_shortcode() doesn’t work if shortcode contained in variable, works if shortcode passed as string
- How to add inline css/js inside a shortcode
- Get image URL from media library in input
- Only execute jQuery function(on document ready) on the page has shortcode from plugin [duplicate]
- Plugin shortcode won’t work on a custom template file [closed]
- Override comments.php template with plugin
- Demystifying and understanding shortcode nomenclature
- Is there any way to get all the name or slug of template parts used in a page?
- Any Short code Availble for Get Post List With Thumbnail Plugin?
- Can we use a webservice with WordPress?
- Where to call add_shortcode function in WordPress Plugin Boilerplate?
- WP Post Template – Templates in own folder
- Register Page Template from Plugin
- Input with spaces in Shortcode attributes overwritten by defaults
- Allow users of my plugin to define their own shortcode rather than use mine?
- Making a Template for a CPT created by a plugin
- Plugin-generated pages use Not Found or Pages Archive templates?
- creating html reusable blocks via shortcodes
- Single API call exposed via shortcode with params
- Creating shortcodes in plugin
- How to create a custom shortcode based on the layout?
- Perform internal redirect in WordPress?
- Inject HTML meta tag inside wordpress tag using add_shortcode
- Create shortcode to echo javascript
- Redirect to another page using contact form 7? [closed]
- Namespaced shortcode?
- how to force tag page layout to use same as search layout?
- How can I run a custom shortcode function on a live site and only run if the viewer is a specific machine?
- Why am I unable to load scripts in head in plugin?
- How to add a dvi tag to a shortcode then change a generated text using jQuery
- Where to find the code used to render a page that has a shortcode and a template defined?
- Default taxonomy template in plugin, override in theme
- IF condition based on wp_remote_get output
- Shortcode Attributes to Return different $_POST
- strange shortcode error: does shortcodes requires any dependency?
- How to rewrite URL and get the values?
- How do I show content from a plugin using the template the site is currently working with?
- Pass PHP variable to javascript
- how to display a template.php in a shortcode
- Thumbnail image doesn’t show up in Shortcode output
- list of custom post by custom field in frontend
- How to check if short code is present in template?
- Shortcode do not return the right data in post
- How to call function in WordPress on button click?
- Hide content for specific users with id
- Why is my shortcode not working?
- How to prevent redoing get_posts queries and make results available to other scripts?
- how to do Thematic like this website using wordpress?
- WP Plugin CSS not being applied to page
- Modify Plugin PHP Class in Child Theme – Correct Method
- How to add HTML to a template only when user is logged out/ not registered
- Shortcode in a blog post, footer and related products stop working
- shortcode which is introduced into entry the blog, and appears in side bar
- Why function hooked using object are executing at all time?
- Shortcode registered from a plugin not recognized
- show Visual form builder in the front end
- Any way to hook into WP after a page displays?
- WP Customer Reviews call short code on another page [closed]
- Display HTML5 jQuery Audio Player On Front Page
- How to make a Template page to show the information of different things Shop and Product page?
- Shortcode cannot parse attributes within double quotes. ” is becoming ” breaking my shortcode
- How to provide page_template path in custom plugin using WordPress
- Display file contents within Plugin
- Include theme header and footer in custom plugin
- How to get next day date of a specific day
- Custom Plugin not Displaying in the Website Production environment (Divi)
- WooCommerce get_price returning wrong price when used via ajax
- How to ‘clone’ a wp plugin to make small changes
- How to load plugin after page is loaded – pagespeed issues
- Open Post Thumbnail in New Child Theme File in WordPress
- Show history of post revisions on front end
- How to pull code snippet from functionality plugin?
- How to use get_theme_mod in gutenberg editor wordpress?
- MITM risk of not sanitizing?
- Get IDs of Images from Gallery Block in InnerBlocks of a Custom Gutenberg Block
- How to keep users unique id stored in session in addition to IP in WordPress plugin?
- Loco Translate: Custom Post and Custom Taxonomy Labels not translated in wp-admin menu
- Where should I save an API key of my user when installing my plugin?
- How to make a customize role and view a specific plugins base on that role?
- Reusable functions and tools (Framework)
- Is Wrapping intval() Around esc_attr() Redundant for Escaping Input?
- Programatically download a plugin
- WordPress plugin – Error “Plugin generate 2890 characters of unexpected output when activated”
- Prevent shortcode from being wrapped in tags
- React JSX in WordPress Plugin Development