1

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.

0

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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