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
- How build a custom login/register form with error handling?
- Why WordPress uses 4 tables to manage terms
- PHP Code stuck in Cache [Memcached] [closed]
- jQuery .each to get post meta and subtract from a sum
- Displaying the Month and Year that a page was Created?
- Static variable and add_rewrite_rule?
- Parse error syntax error unexpected t_string [closed]
- Working with wordpress plugin and theme templates structures
- Generate YouTube image thumbnail in a Gutenberg block – ACF + Timber
- How to upload a file to a folder named after the user_id via plugin
- Can’t access variable outside for loop
- adjust section according to country?
- Issues when changing == to ===
- Why is $wp->request empty in WordPress 6.0?
- How do I modify the custom footer text and get theme version number to show in wordpress admin?
- Make a database query using WordPress
- Get the last 5 products from each category
- Admin-ajax php not working on new wordpress version
- Fatal error: Cannot redeclare function
- Issue Enqueueing WordPress style.css
- Add valid XHTML closing img tags to WordPress galleries
- Only load certain artists on this page
- Using flickr api in custom wordpress plugin
- How to Redirect Buddypress Directories To Login Page For Non Logged in Users
- Prevent Buddypress Rewrite Rules on Non-Buddypress pages/posts
- Woocommerce order status payment
- Display logged in user name and lastname on page
- How to Add a cutsom slug to my custom author role
- Reading URL Parameters
- Issue in displaying the ongoing event and current events in the post
- If is_page include/else not working all of a sudden
- Enqueue script only on child pages of custom post types
- Attach and retrive multiple pdf files to post or page
- Link to index.php from home.php?
- Merging Multiple WordPress Websites
- Replace an array (with identical values) with another array in the_content
- WordPress/NGINX not respecting the category URL for new posts
- Display current user metadata on WordPress page
- Need help transforming echo to return for use with shortcode
- PHP Error Backtrace / create_function deprecated
- Filtering markers on google map by WordPress category[SOLVED]
- scroll scrpit to particular button position to next id when click button
- Check if a user is logged into my WordPress site which is on a different server
- What is wrong in this code?
- perform mathematical operation on shortcode
- WordPress / PhpStorm / XDebug and plugin_dir_path issues
- Do_shortcode on PHP file outside theme ALMOST works
- WordPress 2014 Theme – Featured Content with multiple tags?
- ACF repeater image in video poster with jquery
- How to display the date under the post title?
- What is proper way to use the php if statement? [closed]
- How to conditionally concatenate and translate two very long strings?