WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Not sure how to approach this one.

I have a wordpress page that uses a mysql query to grab info from a database based on the page title.

I basically want to replicate that page to 50 or so different pages all with different titles but the same page code.

What would be the best option for doing something like this?

share|improve this question

The easiest way would be to create a page template. You would assign all 50 pages to your page template, giving each page it's own title. Any content you want to be different on each page could be put into the page itself. Anything that you want duplicated on all of the pages, keep in the template PHP file.

share|improve this answer
Interesting, Is it as simple as copy and pasting your mixed php code and html into a page.php (renamed) file? – mrlayance Sep 5 '12 at 23:47
Correct! Make a page-[slugname].php, and in a PHP comment define Template Name: My Template. It will now appear in the Page Templates dropdown that shows up while editing a page. – Eric Holmes Sep 7 '12 at 13:04
Leave the Loop alone, and underneath it put your content that you want on all pages. That way, anything you place inside the page itself will appear before the duplicate information. – Eric Holmes Sep 7 '12 at 13:05

Your Answer


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.