1
votes

Let say i have 2 page in wordpress, Page A and Page B (please notice this is Pages not Posts).

as default wordpress will use page.php as the template for page.

but now i want to make it like this.

Page A will use template page.php

and page B will use template page-new.php

how i can make that in wordpress?

2

2 Answers

5
votes

Copy the page template, change its name in the comment

/*
Template Name: New name
*/

When editing a page in wp-admin, on the right side is a combo named Template. Your template should show up there automatically, you can pick the template on page by page basis.

1
votes

You don't even need to use a page template, simply create a template file for that specific page, you can do this using the ID or the slug of the page.

Copy your page.php file and name it either.

a) page-n.php
- where n is the page's numeric ID

b) page-name.php
- where name is the page's name(or slug at least, ie the nice version, lowercase and hypens)

All this works inline with the WordPress template hierarchy.
http://codex.wordpress.org/Template_Hierarchy

See the image on the above link for a visual representation of how the template hierarchy determines which file to load.