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.

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

1 Answer 1

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

 
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.