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
0 votes
1 answer
343 views

Create Page with Pagetemplate and get a post_type_object->template

I have created a page per Code with: $my_post = array( 'post_title' => $mytitle, 'post_status' => 'publish', ...
Checkpoint's user avatar
0 votes
1 answer
477 views

URLs Added to ACF Repeater Field are not working

I have created a page using the "Advanced Custom Fields" Plugin and everything is working great except that when I add href url in the field text it doesn't show nicely on Front-end and break the ...
Sheryl's user avatar
  • 42
1 vote
1 answer
372 views

Wordpress page templates in a directory

I'm trying to organize my page-$slug.php files all inside a folder, i saw in a post that it was possible to store the files inside a directory in the root path of the theme... i tried to store them ...
Pedro Ferreira'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
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
1 answer
829 views

Missing 'Page Attributes'

I'm building my own theme and so far so good. I created a template and named it correctly but it doesn't appear in any drop-down or indeed there's even no page attribute option at all. Do I need ...
Henry's user avatar
  • 983
0 votes
0 answers
693 views

INNER JOIN custom tables - SQL Query

H, I am trying to get results from two tables with INNER JOIN in WordPress theme template file, but I don't know what's I am doing wrong. Please help me, here is the code below global $wpdb; $user_id ...
HeroWeb512's user avatar
0 votes
1 answer
140 views

Run Product Filter Javascript On Page Template

I am trying to run the below script on a vehicles WordPress page template. The page template shows products that are the result of a product filter (make, model, year, transmission, etc..). The ...
Webman's user avatar
  • 63
0 votes
0 answers
55 views

Custom post type not pulling CSS

I created a page template for CPT but the it's not pulling up the CSS. Can anyone please tell me what could be the problem?
user12204773's user avatar
0 votes
0 answers
881 views

Show Yoast SEO meta tags in Custom WordPress Templates (Theme)

I overwrote twenty nineteen theme in WordPress and included all my templates. After that, I installed the Yoast SEO plugin to add dynamic meta tags to pages created using custom templates. I have ...
Murtaza Bharmal's user avatar
0 votes
2 answers
35 views

Blog template with different header to rest of site

I would like to change one thing on my wordpress custom template - there are big image sliders used throughout the site except on the contact us, checkout and my account pages. The blog page was added ...
MarvynH's user avatar
1 vote
1 answer
50 views

how to use custom page template in a page?

I have a custom page template, and I want to use this in my page. I have created a new page and in template choose custom page template name. It's working, but I have added 4 blocks in my page, and ...
ashu322's user avatar
  • 13
0 votes
0 answers
249 views

page.php template file render a core gutenberg component programmatically

Is it possible to render a Gutenberg component programmatically directly in page.php template file? I don't have specific requirements and I am newbie as well in Wordpress with Gutenberg. But I was ...
Ravi Maniyar's user avatar
0 votes
0 answers
35 views

Set a template on a custom post in the plugin

I looked at some answers and didn't help I'm trying the next section (right away) but it returns the template if errors in WordPress's built-in function lines. Like get_header () add_filter('...
sbc's user avatar
  • 1
0 votes
1 answer
18 views

Page with some post value id showing page not found

I have customized the template and sending some value using POST method to each custom page. All custom page is working good except the last custom page where I need to insert the data with mail send ...
PratapAmitSingh's user avatar
0 votes
1 answer
220 views

Remove sidebar on single page using plugin API

I’m building a plugin that requires a full width page for a large table. I want to control the sidebar on that page regardless of the theme being used. How do I either, remove the sidebar ...
Matthew Brewer's user avatar
1 vote
1 answer
934 views

the_content() printing DOCTYPE, <html> and <body> tags in the middle of page

I'm building a custom Wordpress theme and I've just come across a bizarre issue where the_content() seems to be printing out the page content wrapped in the following: <!DOCTYPE html PUBLIC "-//...
al.tron's user avatar
  • 139
1 vote
1 answer
476 views

Choosing a default page tempate (Classic => Gutenberg)

This code was working in the "Classic" era to set a default page template: /* Blank Page by default */ add_action('add_meta_boxes', 'blank_default_page_template', 1); function ...
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
1 answer
110 views

list pages using page.php and NOT page-{slug}.php

I made a view templates for specific slugs page1-220 use page.php contact uses page-contact.php service uses page-service.php Now I want to list the pages with their templates on a "overview" ...
Friedrich Siever's user avatar
0 votes
0 answers
20 views

How can I use a custom template to load custom post type posts based on a post_meta value

I have a CPT which saves a location and and its slug into wp_postmeta table. The location is selected from a dropdown in CPT edit page and it is not a taxonomy. Now I want to create a custom template ...
Subrata Sarkar's user avatar
0 votes
1 answer
233 views

Page template not working when logged out

I created a page template that removes the navigation and footer coder (while still keeping the call to the style sheet and any javascript) and it works when I am logged into wordpress, but when I log ...
Kasandra Murray's user avatar
0 votes
1 answer
82 views

Subpage is redirecting to spam site

My Wordpress site has recently been hacked and I followed the steps described here to clear it: https://wordpress.org/support/article/faq-my-site-was-hacked/ The whole site redirected to a spam ...
Mango D's user avatar
  • 101
0 votes
0 answers
64 views

How to redirect to a login virtual page?

I'm writing my first WordPress theme from scratch. I need to redirect not logged in users to a virtual login page, when I do wp_safe_redirect( get_site_url() . '/login' ) I would show a virtual page ...
user avatar
0 votes
2 answers
105 views

How to Change Site Elements based on referring URL

I want to create WordPress website that changes branding and theme based on the referring URL. We provide white label services to funeral homes and we want to create a generic site where funeral ...
Justin Leroux's user avatar
0 votes
0 answers
43 views

Show alternative menu based on page template AND post category

I'm trying to display a menu based on the page template AND the post category is used. I got it to work for the page template like this: if (is_page_template('page-template-heroes.php')){ ...
Biels's user avatar
  • 113
0 votes
0 answers
23 views

Search button click sends to single-custom_post_type instead staying at the same page

I created a template to display search results based on user selects. The problem is after I click on the search button it sends to the single-product(This is a Product custom post type). I also have ...
Testig Content's user avatar
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
0 votes
1 answer
1k views

How do I get the page template name chosen?

I'd like to modify the admin so the default text editor is removed whenever someone is using the default template. (If they manually choose something other than the default, keep the editor). if ($...
Nathan's user avatar
  • 149
2 votes
1 answer
37 views

Taxonomy page template changing when using query variables

I'm hoping someone can help me fill in the gaps in my understanding of page templates and query vars: I've registered a custom taxonomy 'stream', and have set up a page template for that taxonomy, ...
alanbrown-ca's user avatar
0 votes
1 answer
88 views

How to integrate custom HTML template in a premium wordpress theme?

I have installed a premium wordpress theme in the server. But I just want to use my own html and css in the page template. There will be a new header, footer and menu. Is there any way to do that ...
MD. Kamrul Hasan Khan's user avatar
0 votes
2 answers
337 views

Single-page.php template file name not shown

I am developing a theme and I noticed that get_post_meta($post->ID, '_wp_page_template', true); returns 'static-page.php' (as expected) when queried on static pages but returns nothing (expected '...
sergekol'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
0 votes
0 answers
166 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 ...
samjco-com's user avatar
0 votes
0 answers
37 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: <?...
nadia.kl's user avatar
1 vote
2 answers
648 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 ...
user3364610's user avatar
1 vote
1 answer
767 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 ) { ...
Best Dev Tutorials's user avatar
0 votes
1 answer
1k 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/...
F.Marks's user avatar
  • 23
1 vote
2 answers
4k views

Why am I sometimes getting a 404 error when I try to update a page with Elementor?

When updating a page with Elementor, we're occasionally receiving a 404 error. Most of the time we can update the page just fine, but when we try to add a <script> tag or a button with a custom ...
Pikamander2's user avatar
0 votes
1 answer
694 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 ...
saurav.rox's user avatar
0 votes
0 answers
25 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 ...
Smil Miau's user avatar
0 votes
0 answers
24 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 ...
AndiAna's user avatar
  • 101
0 votes
0 answers
17 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 ...
JakePowell's user avatar
0 votes
0 answers
1k 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, ...
AaronJ's user avatar
  • 101
1 vote
2 answers
1k 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'); ...
DimChtz's user avatar
  • 177
0 votes
1 answer
1k 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.
abu abu's user avatar
  • 183
0 votes
1 answer
38 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 ...
Eshban's user avatar
  • 15
0 votes
1 answer
92 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 ...
Raashid Din's user avatar
1 vote
1 answer
1k 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 ...
Amirition's user avatar
  • 345

1 2 3
4
5
25