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
- Plugin upgrading: Widget settings
- Understanding apply_filters
- Editor not displaying dynamically after clicking on the button
- How to submit documentation with plugin
- Placement of Code in Plugin for hooking `save_post`
- Creating a plugin to sanitize comment and the url field before display only
- Creating mySQL procedure with $wpdb
- Editable form for WordPress plugin options page
- remove add new post, if there is already one post
- Change the display of Settings API (do_settings_sections)
- Why is it important to check for isset and is_array before checking in_array in this example?
- Don’t load the theme for a page FROM a plugin EDITED
- WordPress Feed Creator Name Tag Full Name Instead Of First Name
- How to add custom function to pluggable.php
- Remove Zero Money From Previews Order woocommerce
- Access remote SFTP server via WordPress login?
- How to use a shortcode of a plugin in another plugin php file
- Echo custom admin field into a is_single()
- WordPress Boilerplate Plugin doesn’t see callback functions for add_settings_field and add_settings_section
- Hide ‘add to cart’ button for some products [duplicate]
- Upload Image to desired directory through plugin
- wordpress admin-ajax bad request 400