Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I have a wordpress page where I want to include a budget calculation tool.

This budget calculation tool is of course tied to a php script that executes the fields in the budget calculation tool. This php script lives in the file "view.php"

My question is: how can I execute this php script in Wordpress

Here is the script working in a simple HTML/CSS/Js form:

I am so sure this is a beginner thing, but I just can't get my head around it! What am I missing here?

Thanks so much!

Best,

Gabriela

share|improve this question

2 Answers 2

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]'); ?>

share|improve this answer

I would go about this by creating a custom page template. Then plug in the HTML and apply the scripts to this template by embedding the scripts or using wp-enqueue. Then you need to create a new page in WP and assign it the page template you just created with the calculation tool.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.