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
- Custom gutenberg block refuses to load viewScript and I don’t know why
- WordPress generating Undefined Variable warning
- How can I include shortcodes within PHP?
- How to execute html code inside php?
- PHP Warning: strip_tags() expects parameter 1 to be string?
- Run str_replace on title and save the output to a custom field
- Which function crops images in wordpress?
- Using a $GET parameter from a URL, to redirect to a URL (WordPress)
- How to determine from a different folder (outside wordpress) if a visitor is logged into WordPress
- WordPress function and string as variable?
- Delete taxonomy and delete all post related it
- Is a series of update_option calls safe, performance wise?
- plugin add action hook is not working :
- How to call multiple functions from multiple files into a WordPress page template [closed]
- Theme’s Options Page included with require_once *.php in functions.php not visible anymore
- wp-options keep crashing please help
- wp_insert_post: array only. wp_update_post: array|object (?)
- what do I replace get_bloginfo with and where do I find all instances of it?
- Remove dash from blog title wordpress
- Using data sent via AJAX in multiple functions on a WP plugin
- Querying Database with wpdb
- What is the difference in the WP memory limits?
- Limit Taxonomy Output in Conditional Statement
- Problem with AJAX in wordpress plugin
- WordPress archive page showing 404 Error [duplicate]
- wp_redirect only works on main site and not on other sites
- How to remove coupon dropdown feature
- Is it possible to define variables in a wordpress shortcode, and then call the shortcode using a specific variable?
- Is it save to use eval for a jQuery callback method coming from the database?
- Division by zero error in image.php
- Jquery window.send_to_editor function
- PHP include statement not working?
- Code Executing Too Late?
- PHP: Showing currency sign if input is a number
- Displaying text if post was within 5 hours
- New walker for walker_nav_menu to change inside container data
- load ajax using admin-ajax.php
- Create a WordPress shortcode using PHP [duplicate]
- Trying to prepend a Hashtag symbol to the_tags links [closed]
- What does -> mean in WordPress?
- Add data-id attribute to child page links
- WP_OPTIONS table, active_plugins entry [closed]
- Parsing Menu Items and Blog Posts
- Store post content in a php variable and output them using for loop
- Pagination on Custom Post
- Resize image to specific dimension (X to Y ratio)
- Fixing Memory Leaks in WordPress (HHVM)
- Writing PHP code in pages without issue?
- How to use theme function in post/page?
- Running rmdir function on post save
- Logic on a Gravity Forms redirect [closed]