Questions tagged [page-template]

Pages are one of WordPress' built-in Post Types. You'll probably want most of your website Pages to look about the same. Sometimes, though, you may need a specific Page, or a group of Pages, to display or behave differently. This is easily accomplished with Page Templates.

Filter by
Sorted by
Tagged with
83 votes
4 answers
118k views

Create custom page templates with plugins?

Is it possible to make custom page templates available from a plugin?
jnthnclrk's user avatar
  • 1,815
8 votes
2 answers
3k views

Do I need to use The Loop on pages?

I'm writing my first WordPress theme and have a question about the use of The Loop in page templates. The page templates I've looked at all follow basically the same pattern (example from Twenty ...
Jamie Ide's user avatar
  • 183
3 votes
1 answer
2k views

How to quickly switch custom post type singular template?

I have a custom post type called movies and I need to quickly switch the template that displays the movies cpt on the front end via a link. How can this be done? Files I have: single-movies.php ...
MTT's user avatar
  • 3,526
1 vote
1 answer
7k views

Custom meta box shown when template is chosen [duplicate]

Possible Duplicate: Toggle admin metabox based upon chosen page template Is this possible to change editor screen immediately after someone picks some template from the drop down? I need a ...
smogg's user avatar
  • 293
1 vote
2 answers
3k views

Assign Page Template Within A Custom Post Type

I have registered a Custom Post Type and created a file called archive-myCPT.php and another one for single posts called single-myCPT.php. What I want to do is to create a page where I will show just ...
agis's user avatar
  • 421
19 votes
6 answers
21k views

How to *remove* a parent theme page template from a child theme?

I'm using the TwentyTen theme to create a child theme, but I can't seem to get rid of the 'One column, no sidebar' page template that is in the TwentyTen parent theme. I thought just copying it over ...
Osu's user avatar
  • 1,442
7 votes
3 answers
24k views

Add custom template page programmatically

I'm trying to add template page from a plugin,and my template page is in this plugin folder.Is this posible?Here is my code: global $user_ID; $new_post = array( 'post_title' => 'Test ...
user1147's user avatar
  • 802
7 votes
3 answers
4k views

Page Template as Custom Post Type Archive

My goal is to have the slug www.domain.com/resources used by a Page Template rather than an Archive Page, and have single CPT posts as children of that slug, such as www.domain.com/resources/post. ...
wackerfuss's user avatar
4 votes
2 answers
1k views

Adding items to page template dropdown on Page Edit Screen

I am developing a WP theme with MVC approach. It only have index.php, functions.php and styles.css on the parent directory. So, I do not want to place page templates on it rather then I want to ...
Sisir's user avatar
  • 7,762
4 votes
2 answers
5k views

Dynamically link to the latest post or simulate request of specific post in page template

I want to have a link in the wordpress menu pointing to the latest post of a specific category. Because I am not able put a dynamic URL in the wordpress menu, my approach was to put a page with a ...
Pascal Rosin's user avatar
1 vote
1 answer
4k views

Dynamic page.php template for custom post types

I have a couple of custom post types registered. I would like to display all "posts" from each custom post type on its own page, and these pages must be visible in the nav menu. It would be great to ...
Pieter Goosen's user avatar
13 votes
8 answers
22k views

How can I load a page template from a plugin?

I want to add page templates to a theme directly from the plugin. The idea is that the template would show up in the dropdown under Page Attributes, and all the code would need to be in the plugin. ...
smartcat's user avatar
  • 313
13 votes
2 answers
3k views

How to move page template files like page-{slug}.php to a sub-directory?

I want to move page template files like page-{slug}.php to a sub-directory within my theme, in a way that WordPress will recognize them automatically. If the page templates of the said form doesn't ...
manifestor's user avatar
7 votes
3 answers
7k views

Setting a custom sub-path for blog without using pages?

Warning: fairly pedantic request ahead. I have a design that makes use of posts (I.e., the blog) and a custom post type called "howto". The site front page ("/") has a template that displays the ...
aendra's user avatar
  • 1,045
6 votes
3 answers
12k views

How to move page templates to custom folder?

I created page templates that use the page slug, for example, page-contact.php, page-gallery.php etc. or page id, for example, page-2.php, page-11.php etc. How can I move these templates to a ...
Den's user avatar
  • 81
4 votes
2 answers
10k views

Ordering Posts List By Taxonomy Terms?

I am wondering how to write code to order a list of posts by their terms from custom taxonomies? Here is what I have so far: I have a page that lists all the posts in a Custom Post Type, on one page....
Nimara's user avatar
  • 161
0 votes
1 answer
202 views

Trouble with conditional tags

I've got some code I want to run on every page other than the blog page and the archive page. If I use <?php if ( !is_home() ) { ?> The code correctly doesn't show on the blog page. If I ...
Lee Marrett's user avatar
0 votes
1 answer
2k views

Making images from single.php pointing to an attachment .php template

I am trying to make the inserted images from a post (single.php) to point to (single-attachement.php) an attachment page. So far I checked a post here on stackexchange and added this code on the top, ...
Adrian's user avatar
  • 113
10 votes
6 answers
5k views

How can I add an option to the Page Template list from a Plugin?

I've been looking around for the past couple hours for a way to create a custom page template from within a plugin but haven't had any luck yet. What I am specifically trying to do is add an option ...
Jared's user avatar
  • 3,835
8 votes
3 answers
11k views

Is it possible to stop selected plugins from loading on certain template pages?

I have a template page that has form on that is only used once in my site. The form uses form validation using jquery validate plugin (such a great plugin). Once the cart66 Plugin is loaded, the form ...
lomokev's user avatar
  • 173
8 votes
1 answer
12k views

How to retrieve $_GET variables from rewritten URLs?

I need to receive some special $_GET parameters for a custom page I'm making, i know how to receive this through a simple $_GET like mysite.net/products/?id=1 , but I wanted to use the URL style of my ...
Jonathan DS's user avatar
7 votes
3 answers
3k views

Define custom Page Template without its own .php file

Is there any way of defining a Page Template from some function/filter/hook, without having any .php file containing the comment at the top of the page to declare the Template Name? For example, ...
MikO's user avatar
  • 585
5 votes
2 answers
2k views

Creating Ajax backend for Specialised Page Template? Should admin-ajax.php be used?

We're scoping an upcoming project that will require the development of a large php web application within an existing wordpress site - this is for our use only and we've no intention of trying to ...
HeavenCore's user avatar
2 votes
2 answers
12k views

Changing document title only on a custom page template

Hi can anyone help with the below, please? I want to be able to change the contents of my HTML <title> tag only, so need to write an if / else statement. I'm getting myself a bit muddled as my ...
V Neal's user avatar
  • 217
1 vote
1 answer
5k views

Custom post type archive and single.php files not working

Hi I've created a custom post type called shows. here is the code for it. <?php add_action('init', 'show_register'); function show_register() { //arguments to create the post type. ...
Dannyw24's user avatar
1 vote
1 answer
966 views

How to pass a numeric id to a page template?

I am using a Wordpress installation with Wordpress Social Login as a "canvas" for an HTML5-based board game. In the file /wp-content/themes/twentythirteen-child/front-page.php I get the numeric ID of ...
Alexander Farber's user avatar
1 vote
2 answers
2k views

Store Page Template Files in a Subfolder

I have number of legal documents of different formats / layout that I need to display on a Wordpress site, however I don't want to have them as individual page-pagename.php files in the root of the ...
pjk_ok's user avatar
  • 908
0 votes
2 answers
4k views

Remove navigation from header in custom page template

I'm building a landing page and want to remove the navigation menu from the page. The navigation menu is in header.php which is of course in the page template. Is there a WordPress function I can use ...
Anagio's user avatar
  • 953
0 votes
1 answer
123 views

Templates & CSS - Proper Programming Practice?

I've worked with WP/html/css casually for a long while but never dug deep before, I have a few questions about good practices. My Background - totally skip this if uninterested I've been left ...
Murkantilism's user avatar
0 votes
1 answer
167 views

How to show a post single post in page template

Currently I've divided posts into 5 different categories, based on the categories I've created 5 page templates. all of the pages are listed into the home page navigation menu. in my home page I'm ...
Aroor's user avatar
  • 3
0 votes
1 answer
3k views

How to create custom home page via plugin?

I want to code a plug-in that creates new custom home page. Note that I have never coded any plug-in before. 1) After activation of plug-in user needs to go to the options of the plug-in and set up ...
Radek's user avatar
  • 585
0 votes
1 answer
1k views

Problem: ( kriesi ) pagination doesn't work in homepage [duplicate]

When I set this template as homepage, pagination doesn't work. I see the buttons, but when I click the button for page 2, nothing happens, doesn't go on page 2, it still remain in page 1. What is ...
Blanka's user avatar
  • 35
31 votes
7 answers
90k views

Custom templates not showing up in template dropdown

I've got some problems with templates in Wordpress (multisite). I've created a file in the root of my child-theme folder (template-test.php) <?php /** * Template Name: Test template * */ ?> &...
Tom's user avatar
  • 315
23 votes
4 answers
33k views

Use a template file for a specific url without creating a page

I wonder if its possible to use a template file for a specific url without having to create a page for that template. This is my simplified problem: I have created a page in WP with some link ...
Keat's user avatar
  • 447
17 votes
2 answers
47k views

What does is_page_template() compare against?

Looking through the Wordpress documentation, it says that is_page_template() compares against a "template name", if one is provided. I have a template stored in page-homepage.php called Homepage: /* ...
Django Reinhardt's user avatar
15 votes
3 answers
12k views

What is singular.php?

From 4.3 we have a new template, singular.php. I tried to understand what is it, but I didn't get it. :) The page.php for pages. The single.php for every post types. If we have single-[post-type].php ...
user1452062's user avatar
14 votes
2 answers
179k views

How to display page content in a page template?

In my WordPress site, I made a custom page template, which contained a custom query [using WP_Query()]. With that query, I can perfectly get the posts of a certain category. But I want to show the ...
Mayeenul Islam's user avatar
11 votes
7 answers
16k views

Conditional tag to check if 'page.php' is being used?

I'm trying to check whether the page.php template is being used or not. I've tried is_page_template( 'page.php' ) but it doesn't work. I also can't use is_page() because I only want to do something ...
user1981248's user avatar
  • 1,037
10 votes
4 answers
2k views

Is there a WordPress plugin that registers a plugin file as a custom page template?

I need to create a plugin that makes custom page templates available in wp-admin. I'm wondering if someone has tackled this already, as it seems like a pretty typical process?
jnthnclrk's user avatar
  • 1,815
9 votes
2 answers
2k views

How To Create A Paginated List Of All Categories On My Site?

I want to display an archive page with pagination that lists all the categories on my site, and each link goes to that particular category archive page. So this would be like an archive page of ...
gelleproductions's user avatar
9 votes
5 answers
35k views

Page editor missing Templates drop down

Update: As with so many mysteries, the cause turned out to be extremely stupid. I had the file saved in a different theme's directory. Thanks to @a4jp.com I'm building a theme using underscores. I've ...
Thomas Martin's user avatar
8 votes
2 answers
12k views

Passing parameters to a custom page template using clean urls

I am now passing parameters to a custom template in the following format www.example.com/?pageid=12&rid=24&title=this-is-the-title I have created two tables . So I need to fetch data and ...
user7282's user avatar
  • 201
7 votes
3 answers
8k views

What are the differences between custom post type and custom page templates?

What is the difference between custom taxonomies and page templates and custom post types? I think I understand that taxonomy is used to organize data. CPTs are used to give your data a different ...
Steve Fischer's user avatar
7 votes
2 answers
9k views

is_page_template not working

Hi trying this code below to get working, but no look so far. Idea is simple if page template is page-47.php display <h1>Something</h1> else <h1>This will show on any other page</...
soliddigital's user avatar
6 votes
4 answers
24k views

Is there a default template file for child pages / subpages?

This seems like a very simple question. I'm looking for something like sub-page.php or page-child.php where I can do some different things on the child pages of my theme. They are different enough ...
timshutes's user avatar
  • 1,010
6 votes
1 answer
2k views

How to get IDs for objects in menu branch?

Is it possible to print content of all menu items, when displaying menu (or branch of menu as in question about displaying menu branches) ? Once I click on About Us I wish for new page to display ...
daniel.tosaba's user avatar
5 votes
1 answer
175 views

Is it possible to manipulate the list of page templates?

After answering this question I wondered if it is possible to manipulate the dropdown list of possible page templates that's available when you edit a page. WordPress derives this list from the ...
cjbj's user avatar
  • 14.1k
5 votes
2 answers
28k views

Display all posts from specific categories on a page

I want to display all posts from specific categories on a single page. Therefore I edited the page.php file in my theme folder. I added an 'if-clause' to check which page currently being displayed and ...
mybecks's user avatar
  • 351
4 votes
2 answers
22k views

Calling a function from functions.php in custom page/ blog post

Is it possible to call a function from functions.php in custom page or blog post? I put simple function in functions.php: function testTest() { echo "Test"; } And called it from the page: <?...
Mary's user avatar
  • 45
4 votes
1 answer
877 views

Creating a Custom Post Type for Inserting Preset Content into Post & Pages?

In response to Mike Schinkel's comment (see below) on my post about how to pre-populate content (essentially using a content template)... @Scott B I mean why did you support a file on disk rather ...
Scott B's user avatar
  • 5,666