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 developed some calculators (in php) for my website and I need Wordpress integration. The calculators have a form and, after submission, the result is shown. The result depends on a query in the database. Is it possible to create "static pages" (at least static URLs) that provide to the user dynamic content?

Just to clearfy, I want something like:

website/blog    
website/forum   
website/calculators
website/calculators/one
website/calculators/two

I heard about Pages, but I cannot include php code on it. Worth point out that the calculators aren't static, the result will change everyday.

share|improve this question

1 Answer 1

up vote 0 down vote accepted

You do want static pages. The easiest way to do this, and a very good way even if perhaps not the only way, is:

  1. Create one or more custom template files for your static pages. This is where your PHP comes in.

    /*
    Template Name: Calculator
    */
    get_header();
    
    // your calculator code 
    // Whatever PHP you have should work
    
    // This is very minimal. You may want something more complicated. 
    
    get_footer();
    
  2. Save the file as some name not on the reserved list

  3. Create your static pages from wp_admin->Pages. Why creating the pages, save them with appropriate "Template"-- that is, one of the ones you've created. (Look in the right sidebar under "Page Attributes".)

This way, you can keep the calculator pages consistent with the other pages on the site.

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.