The short answer is to add it to whatever page template you would like. The view.php file sounds like the wrong place, but if you want it there, just add that code to whatever section of the page you want.
If you want to go a better route, I’d turn that bad boy into a shortcode. Shortcodes have a bit of a learning curve, but are extremely useful. The benefit to this being that instead of having to copy/paste the code into a new area each time – you can just call [calculator] or whatever you eventually name the shortcode. If you want to execute the shortcode in a template file simply put something like this: <?php echo do_shortcode('[calculator]'); ?>
Related Posts:
- Get only enqueued styles and scripts of the current theme
- Trigger a php file on every post or page if a condition is met
- Enqueue less file not working in child theme?
- Execute only on a certain page
- Is it recommended to pass some data to scripts in `wp_enqueue_scripts`?
- if file_exists not working with wp_enqueue_style
- enqueue hover function
- Adding tawk.to code just before body tag on functions.php file
- How to enqueue CSS and JS only on specific template?
- Deregistering a script in WordPress seems impossible
- How to inject variables into public-facing JS using wp_enqueue_script
- How to only enqueue script if it’s a post
- WordPress Scripts Being Loaded in Footer
- Jquery function working in Dev Console but not otherwise [duplicate]
- jQuery code not working when included in functions.php
- Conditional Javascript based on WP Version
- Is the wp_enqueue method efficient?
- Correct way to enqueue page specific CSS file
- linking stylesheets and scripts with functions.php
- Double jQuery loaded
- How to: Conditionally Enqueue JS and Stylesheets, for Custom Post Type (Single and Archive Templates)
- How to use wordpress function wp_enqueue_script() in php?
- Enqueing External JS on the remote server JS
- Trying to enqueue script – Nothing Happens
- url_to_postid returns 0
- ‘Bones’ theme: Load stock scripts in footer instead of header?
- Enqueueing a code block from an options framework
- Ajax on the Administration Side of plugin – wp_localize_script – how to pass value from JQuery to PHP function in class?
- Using Google Analytics in an enqueued JS file
- Enqueue assets from multiple directories using add_action/do_action
- How to change order inside foreach using wp_enqueue_script?
- Call a single function on two different methods with hooks
- Enqueue sripts and styles only if function is called
- Load script and styles using an array of resources
- Importing the style and scripts in the plugin doesn’t work as well as in the theme
- When to use wp_register_script() function?
- How to stop loading my custom scripts files for wordpress iframe?
- How can I enqueue comment-reply script only on certain page?
- Chosen Select jquery Not Working in Plugin
- Adding javascript files to WordPress and jQuery version
- How can I print out a single stylesheet or javascript link?
- Adding Gravity Form With if(is_page) Is Not Working
- wp_enqueue_style conflict when using in different action hooks
- Errors while Loading Most Recent Version of jQuery
- Warning: filemtime(): stat failed for wp_
- How to enqueue structured data as file – jsonld file seems not to work
- Make a variable global and use it for inline script
- functions.php doesn’t load all custom theme assets
- in_footer: gives syntax error
- WordPress generating Undefined Variable warning
- count() parameter must be an array or an object that implements countable in laravel
- Allowed memory size of 268435456 bytes exhausted (tried to allocate 7146491840906359738 bytes)
- Receiving Stripe Webhooks on a wordpress website
- Sorting list of sites from multisite network using wp_get_sites
- Remove Customize Background and Header from Appearance admin menu without CSS or JS
- How do I get the author’s page url from their ID?
- Gutenberg custom block using only register_block_type() and HTML
- Keep salts when moving a site?
- Why WordPress uses `endwhile;` inside the templates?
- Theme url in all plugin pages
- Upgraded to php7.0, now ssh updates don’t work [closed]
- How to add a dynamic javascript snippet to the footer that requires jQuery
- How can I get the page or post language when I use wpml? [closed]
- Redirect to a different page through registration, depending on page
- Creating a related post section based on similar categories
- How do I retrieve meta_key names with get_user_meta($user_id) call
- Headers already sent in Pluggable.php / homepage and wp-login error
- get the correct url for an folder in wp-includes wordpress
- Can i put my shortcode inside a variable in php files?
- How to fix “Object of class WP_Term could not be converted to string”?
- Loading two post layouts for the same post with different url
- Parse error: syntax error, unexpected ‘}’ [closed]
- Personalize checkout text
- When echo follow Ajax button inside Ajax pagination template not working?
- Nginx WordPress and another Web app URL structure
- Can I remove or edit an include() from a function with a filter?
- WordPress time queries
- Send an e-mail on address with the link with disliked post
- List sub categories and corresponding posts of a parent category
- Woocommerce My acount page
- Pages from admin dasboard missing after site migration
- Menu not updating for logged in users after redirect
- Change upload URL by mime type
- How To Add Custom User Meta During Registration
- Where to check in PHPmyAdmin / SQL database for subdomain
- Save the outputted image into the Media Library, with a different filename and extension
- Image limit from 1 to 5
- Splitting One Big WordPress Site into Multiple Small Sites
- How to link a word comprised of a custom field with another?
- Can’t upload files
- Shortcode not passing variable to included file
- I can’t seem to get excerpts showing inside get_pages and don’t know why?
- image dimension in php code args
- I need a button to appear when not loged in and another when logged in, I need help fixing code PLEASE!
- WordPress different custom tag being displayed in on tag list
- Weird Javascript:void(0) code in my website
- PayPal button not showing and cannot retrieve order error in PayPal
- Why do I get a 404 error on my custom post type archive pagination?
- Need Help With Making Full-Width Template for Blog Posts (common methods aren’t working)
- Trouble Sending Elementor Form Data via cURL in WordPress