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.

320 questions with no upvoted or accepted answers
Filter by
Sorted by
Tagged with
4 votes
2 answers
631 views

load/require specific php files for specific pages/templates/post types

I have a plugin with multiple php files. I want to load some of them only when specific template files are loaded. I don't want to load everything. Currently, I'm doing it with add_action( 'wp', '...
eddr's user avatar
  • 41
2 votes
1 answer
229 views

Get name of current page template in Gutenberg era

In a block theme I'd like to be able to make some edits to the head meta based on the (block-based) page template used. The traditional get_page_template() doesn't seem to work as hoped in this case (...
jshwlkr's user avatar
  • 512
2 votes
3 answers
2k views

How to specify which Gutenberg blocks are available in the editor for a page template

Using an example given here: enter link description here I've successfully been able to restrict the block types available globally or by post type (eg: page). But what I really would like to do is ...
UntitledGraphic's user avatar
2 votes
1 answer
2k views

Hyphens instead of Underscores in Post-type Archive Template Filenames when Post-type handle contains underscore

I'm working on implementing WordPress coding standards on a theme which has several custom post-types, each of which have underscores in their handles. The theme uses the custom post-type handle in ...
admcfajn's user avatar
  • 1,306
2 votes
1 answer
238 views

Dequeue theme stylesheets but keep widget styling on custom page template

Bit of an unusual one. I have created a plugin that will only display content on a custom page template. For this reason, I have dequeued all the theme styles via $wp_styles and loaded in the plugin ...
scopeak's user avatar
  • 213
2 votes
1 answer
61 views

Including Custom Post Type posts in a page template contextually (or should I widget?)

Please see the attached mockup… Each element in the sidebar (e.g., Communications) will probably have to be a Page. I'm aiming for maximum flexibility. I am using Epik (a Genesis child theme). I ...
Lorin Rivers's user avatar
2 votes
1 answer
365 views

Help with CPT template pagination

i created a themes CPT using the following code function pp_themes_post_type() { $args = array( 'public' => true, 'label' => 'ProfilePress Themes', '...
W3Guy's user avatar
  • 264
2 votes
2 answers
2k views

Full width layout for custom post type pages

I'm trying to remove a widget area called 'Primary' from a certain page on a site. This is the function where I manage the sidebars: //ADD CATEGORIES IN SIDEBAR OF SINGLE POST TYPE add_action( '...
Damon's user avatar
  • 275
2 votes
1 answer
85 views

After updating a page, all pages on the site used the index.php template

I am having a strange problem with a site I am currently building. I will try to give as much detail as possible in the hopes that somebody is able to figure out what is causing this :) Overview of ...
Adam's user avatar
  • 555
1 vote
0 answers
37 views

Can you programme the selected page template to display block patterns automatically?

Ideally, if I select a template called "3 columns", the block patterns layout I've premade would automatically load into place. I understand you can predetermine regular posts block pattern ...
NotReallyRuby's user avatar
1 vote
0 answers
35 views

Pagination stopped working after assigning custom page template to new page (different slug)

I am having a problem with pagination on one of my CPT after assigning the custom page template to a different page with a different slug. It all worked perfectly on the test page I developed it with. ...
Ralf Weber's user avatar
1 vote
0 answers
16 views

Wordpress Pagination changes my template

I have a problem using pagination for terms in my custom taxonomy, let's call it Case-Studies. If i go to /insights/page/2, posts will be displayed correctly, and I can navigate between pages. The ...
Calin Diea's user avatar
1 vote
0 answers
51 views

Create Page Template by hook programatically in Functions.php in WP 5.8.1

Create template as file is great. How to do that by dynamic function? What hook, function I need to add dynamic template to dropdown in page. If I won't have access to server files then I stuck - no ...
Patryk's user avatar
  • 111
1 vote
0 answers
61 views

Getting page output HTML without request (for CriticalCSS, PurgeCSS)

I work a lot with legacy website with css files which were shared across many pages which resulted in really bloated stylesheets shipping to browser. I want to do some performance tricks to avoid this ...
jamkaka's user avatar
  • 11
1 vote
0 answers
28 views

Verify if the current page has at least one published child

In my theme php page template, I need to echo a string only if the page has at least one published child page. Actually, I have a function that verifies if the current page has any children, ...
Myriade's user avatar
  • 11
1 vote
0 answers
281 views

Missing 'Page Attributes' in page edit

Im missing Page Attributes from page edit screen. I have searched and not found any solution. Anybody with some ideas?
Morgan's user avatar
  • 11
1 vote
0 answers
261 views

Can't access variable outside for loop

My problem is that I can't access the $cat_slug variable inside the [display-posts] short-code. The idea is to use that variable to dynamically pick post categories via the array returned from ...
Jacob Stordahl's user avatar
1 vote
0 answers
25 views

Plugin-generated pages use Not Found or Pages Archive templates?

A WP Plugin we developed dynamically generates storefront pages at a subdirectory of the merchant's site, populated with product data the plugin syncs from our own servers--e.g., the storefront may be ...
SubGothius's user avatar
1 vote
0 answers
75 views

Rewrite rules automatically for pages using specific template

I'm using rewrite rules to add an optional parameter to a page. This page uses a specific page template which handles the implementation of an external data source. add_rewrite_rule('^page/([0-9]+)/?'...
Julian F. Weinert's user avatar
1 vote
1 answer
21 views

Get list of taxonomies associated with Subscribers

I used this tutorial so that I would have the ability to associate categories with users. However, I changed the code so that it would show only on Subscribers profiles (not Authors like in the ...
Donna Hall's user avatar
1 vote
0 answers
260 views

Showing the WordPress standard text area on a Woocommerce Single Product Page?

I'm trying to show the WordPress default text area on a Woocommerce Single Product Page but can't find the appropriate hook to add to the template? I would have thought it would've been well ...
Michael Gearon's user avatar
1 vote
0 answers
28 views

need help with a user-specific custom page template

I created a custom page template that will show sales from a hotel. I have 3 users and I want each user to only see their hotel sales on a user profile specific page. The template calls data using the ...
David Delatorre's user avatar
1 vote
1 answer
28 views

redirect automatic page that serves custom posttype content

I registered blog as a custom post type. This content is queried on the page page-actueel-blog. But mydomain.com/blog also serves content (by default titles are queried). I don't want visitors to ...
Ludo's user avatar
  • 51
1 vote
1 answer
277 views

Wordpress showing archive.php instead page

I have a problem with same name (slug) for category and page and wordpress is showing archive.php instead page custom template. Permalinks settings for category is . and i want to stay this way but ...
Jakub's user avatar
  • 11
1 vote
3 answers
790 views

How to create a custom page(not a template) in a theme

I have been searching for theme developing info but all that are related to this subject are talking about a custom page at page.php. What I am trying to achieve is different. The scenario is that I ...
adrian li's user avatar
  • 143
1 vote
0 answers
265 views

How to render a custom post type template with custom fields using shortcode

I have a post type called "Milestones" which has several custom fields and custom a template to render it. What I am looking for is a way to return all the rendered output from a shortcode. The ...
frezq's user avatar
  • 111
1 vote
0 answers
75 views

Prepopulating a specific page template with HTML/CSS

So, I'm trying to prepopulate a specific page with HTML/CSS every time the page template is used. I've found this thread that was very helpful with how to do it, and this one was very helpful on ...
Beauregard Lionett's user avatar
1 vote
1 answer
33 views

displaying category and subject posts

I have single post pages, that displays the page subheading based on the category name or subject name. I am having issues display category titles as well as subject name. Essential what I am trying ...
NewKidOnTheBlock's user avatar
1 vote
1 answer
51 views

Content pulled from page template instead of editor

Just inherited a client site that is a bit of a mess and am looking for some help. All of the content is within the php page template, it is not directed to the WYSIWYG editor at all (which I would ...
ingcol's user avatar
  • 11
1 vote
2 answers
1k views

How to duplicate a page template but make minor changes to the header?

I will apologize in advance, I am very new to this. I have been teaching myself php as a hobby, but now I need it for work! I don't work as a web designer, but to try and save some money, I need to ...
jedidesignerd's user avatar
1 vote
0 answers
3k views

add_filter('query_vars') not working in custom template

I'm trying to add a query parameter to a custom template in order to look up a record from the DB with the ID passed in. Here's how I'm attempting to do it: At the very top of my custom template, I ...
Alex Kibler's user avatar
1 vote
0 answers
49 views

Trying to return list of child pages for a template

I am trying to return a list of Child pages that belong to a template. I then show these on a different page. I have a Store, that has store child pages. On a products page (not related to the ...
Joana Ashford's user avatar
1 vote
2 answers
209 views

Adding a hook to the default (page.php) template

I'd like to add some custom HTML and jQuery to a page built with the page.php template. I know how to do the HTML and jQuery I want in functions.php but I'm not sure how to get a hook into page.php ...
Steve's user avatar
  • 185
1 vote
0 answers
45 views

SuperCache for Custom Templates

I've started creating custom templates. For instance, I wanted a news template for posts that are news oriented. So, I made news.php <?php /* * Template Name: News Article * Template Post Type: ...
jonbon's user avatar
  • 143
1 vote
1 answer
85 views

Populate editor with some content of a page with a page template

I have a page template like "page-salespage.php". what i'm trying to do is show default content in tinymice editor when this page template applies to a page. here's how i tried to achieve this, but i ...
greenarrow's user avatar
1 vote
1 answer
186 views

Adding Query to Custom Page Template

Probably a simple, stupid question, but: I'm trying to create a page that displays a list of all pages that include a specific ACF value. I copied page.php from my active theme folder, renamed it ...
Jake Nelson's user avatar
1 vote
0 answers
180 views

Custom Taxonomy isn't working from frontend post submitting

hi, i am working on a video sharing site project! I have Created a Template file where people can submit their post as video! Everything was working very good, but the custom Taxonomy ponstars isn't ...
Shorna Akter's user avatar
1 vote
0 answers
323 views

Get the url of a page template without using the page slug and ID

Can I get the url of the page "page-template-contactus.php" using "template-contactus" only?
M. Monica's user avatar
1 vote
0 answers
1k views

Undefined Variable: mysqli error when connecting to database

I know this question has been asked before, but the solutions have not been working for myself. I am receiving this error while trying to connect to a database from within a wordpress template file. ...
bilcker's user avatar
  • 145
1 vote
1 answer
738 views

Template selection area is not visible on page editor sidebar in wordpress twentty sixteen default theme

Template selection area is not visible on page editor sidebar in wordpress twentty sixteen default theme <?php /** * Template Name:Zoho testAPI * * * * */ echo phpinfo(); ?>
Vivek Tamrakar's user avatar
1 vote
1 answer
313 views

All top-level pages are using index.php as template

On my site, all top-level pages (i.e. mydomain.com/example-page as opposed to mydomain.com/parent/example-page) will only use index.php as their template. They won't use page.php, they won't use ...
Pete's user avatar
  • 317
1 vote
1 answer
344 views

Move default page templates to sub directory

So I know there having custom templates in a sub-directory is a native feature introduced in 3.4. But I'm not talking about custom page templates here. I'm talking about the default page templates ...
John_911's user avatar
  • 566
1 vote
1 answer
4k views

How to get the value of input hidden html from text editor to custom page template?

I have 10 or more input hidden in 10 or more pages with different values in Wordpress text editor and I want to get the value using $_POST in a custom page template. How to do this? I tried to called ...
User014019's user avatar
1 vote
0 answers
79 views

Show Custom Post Type meta boxes only on Page Edit

I've went through the laborious process of creating the CPT. I see it on the sidebar of my WP install, I can add new, save data, and on frontend I can output the data. Is it possible with WP to move ...
Zach Smith's user avatar
1 vote
0 answers
291 views

Adding the_content() in custom template email

Let my explain the scenario first: I have a very custom page template. That is use in combination with a CPT and a few Custom fields. The CPT is called "werklijsten" (it's in dutch so bare with me) ...
RichyVN's user avatar
  • 46
1 vote
0 answers
203 views

Creating a Page Template to display all items from a Custom Post Type

To begin with I should note that I'm fairly new to both php and editing in the WordPress-files, BUT I have actually managed to succesfully create a page template that puts out a list of all items in a ...
rpbtz's user avatar
  • 325
1 vote
0 answers
569 views

Problem with multiple shortcode in page template

We have a page (wmnf-events.php) with no content that uses a template file (page-wmnf-events.php). The template has 4 different div containers where each container has the same shortcode but for a ...
Robert Fitzpatrick's user avatar
1 vote
1 answer
390 views

Filter widget outputs

I've been trying to find a good solution for my problem, but I can't seem to find anything on this topic at all. I've got a custom sidebar, created by using register_sidebar and I've used wordpress's ...
Ian Ryan Clarke's user avatar
1 vote
0 answers
583 views

Page template without header & footer

I have created a page that doesn't use the header and footer. I have closed all the tags, but the page is breaking, nothing appears. My code is like this, <?php /* Template Name: [Blank] /* ...
hkchakladar's user avatar
1 vote
0 answers
32 views

how to setup custom content structures

I have some custom pages I need to develop, and I want them to be easily edited by my client. The problem is that the markup is fairly complicated, I want to be able to give them the ability to edit ...
Duncan's user avatar
  • 11

1
2 3 4 5
7