Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

0
votes
0answers
19 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 ...
0
votes
0answers
17 views

How to show WP admin edit page within template page/post?

So I am wanting to show the wp-admin/post.php?post=999&action=edit Inside my custom template of the single.php and page.php. So I understand that I can do it using an iFrame by basically ...
0
votes
0answers
15 views

Pagination Shows Up But Won't Work on Custom Gallery Page

I'm trying to build a post gallery page with pagination. Posts and pagination are displayed fine but for some reason pagination won't show the clicked page and remain on page 1. This is my code: <?...
1
vote
2answers
78 views

Disable front-page.php template

I use front-page.php on my template to display home page. But I want to disable if the user uses another page for the home page from settings. Is there a solution? When user select a page from ...
0
votes
1answer
22 views

Pre get posts where template is not equal to one specified?

I'm trying to not show certain posts in the admin area based on the page template. Here is what I have so far: add_filter( 'parse_query', 'hide_some_posts' ); function hide_some_posts( $query ) { ...
0
votes
1answer
26 views

How to properly add and access a JavaScript file in Wordpress?

I intend to use a JavaScript library on my WP website and have uploaded the JS file via FTP to the following directory belonging to the currently activated theme Salient: /public_html/wp-content/...
0
votes
1answer
81 views

Page template added via plugin not saved in Gutenberg

I have added page templates via plugin. It works absolutely fine with classic editor but while using Gutenberg, the page can not be published when page template is assigned. However, page templates ...
0
votes
0answers
21 views

I want to edit the tags template by adding text that displays all tags from the listed posts

So I have tag "Iphone", I enter on page of this tag and there I get the: h1 description Listed posts that have this tag I want to add between description and listed posts the sentence: You can also ...
0
votes
0answers
15 views

Why does a custom php code inside a custom template not get executed?

So in order to have some php code executed inside a page on wordpress there are 2 ways. One of them is to create a page template and when creating the new page in wordpress set the Page Attribute to ...
0
votes
0answers
11 views

How can I use one instance of page.php to display different custom post types?

At the moment I'm using multiple page templates to display custom posts (page-events.php, page-resources.php) and it seems wasteful. How can I reuse page.php and just display the post type relating ...
0
votes
0answers
44 views

Display a custom 404 page without a redirect

In a plugin I want to display a specific page without redirecting (and thus without changing the URL) like the plugin https://wordpress.org/plugins/404page/ does. I can capture 404s and redirect them, ...
0
votes
2answers
40 views

Display ACF if parent page has specific template

I am trying to make a new ACF rule to display fields when parent page has a specific template name. Here's my current attempt: add_filter('acf/location/rule_types', 'acf_location_rules_types'); ...
0
votes
1answer
41 views

Adding a Menu Page to The Dashboard

http://127.0.0.1/wordpress/wp-admin/admin.php?page=allValue.php I would like to know the location of allValue.php file.
0
votes
1answer
24 views

How to load page template according to the Searched Page

I have a search form which uses RELEVANSSI plugin to perform search and display Search Results. On my Search Results page there is pagination and Search Filters(hyperlinks) which allows user to show ...
0
votes
0answers
13 views

I can't see any options when I click on add theme and when I edit on Home Page using Elementor I get error

I have 2 errors on my wordpress websites:- 1) When I click on add theme, I cant see any option just blank screen like this. 2) When I edit Home Page using Elementor, I get the following error, Can ...
0
votes
1answer
14 views

How to show metabox on page if it is using a template

I was creating metaboxes for a special kind of pages. But i got stuck when showing metaboxes to the pages only who currently have the template 'Sky'. my template file name is sky-template.php and ...
0
votes
0answers
14 views

Woocommerce widgets don't appear on my custom template

I have created a page in Divi theme, and i displayed the shop grid with a loop. I tryied to add in the sidebar, a widget (Filter by price), but it doesn't appear on my custom page, but in the shop ...
1
vote
1answer
29 views

Problem with parameters in url and pagination

I created a custom template page and I show users list in it. I have a pagination for this users list and when I add a user to this list, I show a message at the top. This messaged is created from a ...
0
votes
1answer
32 views

providing access to post_id or post inside functions.php

I'm trying to add metaboxes to the bottom of any post which is created from a specific post template. ie I don't want metaboxes on all my posts, just certain posts. At the point when I decided to ...
1
vote
2answers
49 views

How to redirect Wordpress home page to custom static HTML page

I am facing an issue while I upload the custom HTML page into my Wordpress site. The page all alone working fine as I put it in separate folder or if I change its name to index.php . But then their ...
0
votes
1answer
7 views

How to use the same custom page template to iframe multiple urls with entry of new url entered from backend

I am using this custom page template to iframe mulptiple urls. Currently I have been making a new custom page for each new url. I want to be able to use the same generic custom page template, and be ...
0
votes
1answer
28 views

How to save multiple values in custom post type from front end to back end

i created a plugin in WordPress , i created custom post type called "invoices" here it's the code add_action('init', 'invoices_register'); function invoices_register() { $labels = array( '...
0
votes
1answer
20 views

Set page template automatically according to parent slug

I've seen several similar topics on this forum but still unable to come to a solution. I have a parent slug named "en". I named its template as "page-en.php". Every time when I make a child page ...
0
votes
2answers
26 views

How can I make custom page templates work on child theme?

I have created a page template called concert.php under page-templates directory with the following content: <?php /* Template Name: Concert*/ add_body_classes('page_concert'); /* Custom ...
0
votes
2answers
28 views

Wordpress pass url to page template when page does not exist

I created a page template to serve information dynamically. For url like example.com/the-hamptons => index.php?page_id=92&filter=the-hamptons For url like example.com/page-that-exists <- ...
0
votes
2answers
58 views

How to display the contents of URL1 when user visits URL2

I know how to do it with apache/mod_proxy, but I can't use mod_proxy on our shared host. So no .htaccess solutions. Currently I have the following code in child theme's page.php global $post ; if( ...
0
votes
0answers
27 views

How to add a full working piece of website already coded, to a large scale Website design project?

I've written 5 PHP files each of which are dependant of each other and contains one style.css also. This whole project works fine when executed alone and includes home.php which includes HTML code for ...
0
votes
3answers
66 views

WP_Query returns different results from get_posts() [closed]

So I have two code snippets, trying to get the child pages of the current page. The current page is "Sample", and the following code lives in page-sample.php. The first snippet uses get_posts() $...
2
votes
3answers
63 views

Loading page template into shortcode

I am attempting to load a page template into a shortcode so I can easily load the content wherever I want. I have done some research and many people have said this code has worked for them but for ...
0
votes
1answer
22 views

Hide Page Title with Post Meta

I tried to write code to have a checkbox on Pages in the backend to check if I want to hide the title of the page in frontend. But I find that the post meta is sometimes reset to show the title even ...
0
votes
0answers
11 views

Finding and removing a particular page that shouldn't be active

So I have rogue pages that are in my site, that shouldn't be there. Using a theme, and these are left over from the theme I believe. I'm new to wordpress, and I'm trying to figure out how to find the ...
0
votes
1answer
126 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</...
0
votes
3answers
30 views

Why doesn't my very simple jQuery work?

I just deployed a new Wordpress site. Everything looks good, now I'm setting up jQuery: Child theme functions.php: //enqueue scripts function my_theme_enqueue_scripts() { wp_register_script( '...
0
votes
1answer
18 views

Showing Custom Post Type with his templates on a custom page template

So here's my question: I need to build a custom post type to add employees to a website. The problem is, it need to be shown: 1 - Image on the Right 2 - Image on the Left ... and so on. For this I ...
0
votes
1answer
13 views

get_avatar() as backround image

<div class="kkk" style="background-image:url('<?php echo get_avatar_url(); ?>')"></div> I want to make to appear my avatar as a backround image in this code, but it doesn't work. ...
0
votes
0answers
22 views

Wordpress Product Detail and catalog

I want to have post for every product, some product may have similar feature.For example Size with different Value for each one. and some other product doesn't have Size Feature. i see this page and ...
0
votes
1answer
33 views

How to require specific PHP files for specific templates

How can I require specific PHP files for specific templates without any hook? Example: I've one PHP file "autocomplete.php' and once a page template "photographers.php' Now I want to require '...
3
votes
2answers
52 views

Add Archive Page Template via Plugin

So, I'm in the process of writing a plugin for a specific site. I understand WordPress picks the page template from the theme, with php script names according to the chart below. However, I'd like to ...
-1
votes
3answers
91 views

page-{slug} not loaded in custom theme

I'm working on a custom template for WordPress. I've created some page and then created the relative page-{slug}.php (example page-careers.php) that are supposed to be loaded from WordPress when the ...
0
votes
1answer
15 views

Displaying posts inside table having issues

I am trying to create a comparsion table like the attached image. But it was not working like in the image. for that i have done following code what i am getting is not like the image for example the ...
0
votes
1answer
22 views

get_the_excerpt() inside WP_Query - link URL Incorrect

I have a custom WP_Query loop, to pull out specific posts, that is working exactly as expected. The link can be retrieved from get_permalink(), as can any content that I'm requesting including ...
0
votes
1answer
20 views

Redirect based on referer using Advanced Custom Fields

Im currently trying to protect some WP pages by assigning a specific template to them. Ive created the ACF fields "Referring URL" and "Redirect URL", as these could alter depending which page the ...
1
vote
1answer
20 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 ...
0
votes
1answer
44 views

Set page template programaticlly in plugin

Task: I have created a page using my plugin and that page has to be set a certain page template within page creation. Everything works apart of setting page template. I have manually moved page ...
0
votes
0answers
28 views

How to Remove/Edit CPT template Content with Custom Meta Box

I try to Remove CPT template(single-proucts.php) Content with Custom Meta Box. I created a Input select option for change content in my CPT metabox it's working then update post I need to change ...
0
votes
0answers
26 views

Change Page Template Based on URL Rewrite in WordPress

I have created a custom post type author when it takes to single author details it was working fine. For example http://localhost/author/james/ It was showing single-author.php file. My question is ...
0
votes
1answer
31 views

How can I add text to a specific 'Edit Page'?

I have a specific Page, that I do not wish to be edited. As such, I would like to place a 'Do Not Edit This Page' message within a specific 'Edit Page' file as follows: Any ideas on how this can be ...
0
votes
1answer
23 views

Change Size of P Tag on One Page Template [closed]

I have two blog types on my website (Blogs and Updates). I need to change the P tag font size in both page templates. These are the page templates that show a list of the posts/articles. Blogs page (...
0
votes
1answer
14 views

Inserting article:tags meta in html head-element, using get tags, no wp_head

I´m trying to add code to a template file of mine, working with a raw theme I generated from “”. The file is a duplicate of single.php and called single-post.php. Like WP states in Codex. I am trying ...
0
votes
1answer
17 views

Static page won't identify template

I have two pages, one working correctly and one broken. The first is called Calendar and it has an ID of 34. I created a page template called page-34.php and wrote some custom code, and when I load ...