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
3 votes
2 answers
8k 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 ...
Talha khan's user avatar
0 votes
1 answer
231 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 ...
Troy's user avatar
  • 1
0 votes
1 answer
385 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( '...
user2631855's user avatar
0 votes
1 answer
310 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 ...
Sushimaru's user avatar
0 votes
2 answers
76 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 ...
Victor Oliveira's user avatar
0 votes
2 answers
330 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 <- ...
jdias's user avatar
  • 183
0 votes
2 answers
77 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( ...
Dakshinamurthy Karra's user avatar
0 votes
0 answers
33 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 ...
Shashank V Ray's user avatar
0 votes
3 answers
514 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() $...
Aneesh Barthakur's user avatar
2 votes
3 answers
4k 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 ...
Ibrarr Khan's user avatar
0 votes
1 answer
333 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 ...
anielfeyt'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
0 votes
3 answers
84 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( '...
Rollor's user avatar
  • 129
0 votes
1 answer
41 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 ...
Ariano Ângelo's user avatar
0 votes
1 answer
44 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. ...
Asking's user avatar
  • 121
0 votes
0 answers
28 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 ...
Davis Miller's user avatar
0 votes
1 answer
136 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 '...
Md Abul Bashar's user avatar
3 votes
3 answers
2k 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 ...
Codesmith's user avatar
  • 167
0 votes
1 answer
17 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 ...
James Paul's user avatar
0 votes
1 answer
420 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 ...
JoeP's user avatar
  • 101
0 votes
1 answer
1k 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 ...
Mike's user avatar
  • 1
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
2k 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 ...
Prusakov's user avatar
  • 125
0 votes
0 answers
194 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 ...
James Paul's user avatar
0 votes
1 answer
90 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 ...
Craig's user avatar
  • 358
0 votes
1 answer
61 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 (...
Webman's user avatar
  • 63
0 votes
1 answer
172 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 ...
andiOak's user avatar
  • 161
0 votes
1 answer
28 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 ...
ConorBaumgart's user avatar
0 votes
1 answer
53 views

Create page when a new site in multisite network is created?

I found this code to automatically create a page when a new site is created in the network. But I cannot figure out how to set which page template to be used when the page is created. I have a custom ...
joq3's user avatar
  • 371
0 votes
1 answer
105 views

How can javascript be added to a custom-page.php template?

How can javascript be added to a custom-page.php template? How can the following javascript gotten from w3schools ajax tutorial be made to work from a custom-page.php template? Any help would be ...
65535's user avatar
  • 135
0 votes
2 answers
41 views

WordPress blog posts template bug [closed]

I'm facing an issue I've never seen before. I fully copied a WP website to my localhost machine and everything was looking fine. When I was trying to make some changes on the blog page template (that ...
joaogdesigner's user avatar
0 votes
0 answers
34 views

how do i fixe Page Builder on a custom page?

hi i create a theme from scratch for wordpress (with header and footer) i did my home-page but for the other page i wanted to keep the header and the footer and using Page Builder for the content but ...
matthias screed's user avatar
0 votes
1 answer
47 views

inserting content of 1 Post to in another with a template hierarchy

I have a page template I use for landing pages for various ad campaigns. The template uses custom fields for things like headlines and other shorter pieces of content within the page. However the ...
Daveh0's user avatar
  • 189
1 vote
2 answers
68 views

Adding sidebar to template creates horizontal gap the size of the side bar

I have been killing myself trying to figure this out on my own. And I for the life of me cannot figure out what is causing my issues. I created a template for the testimonials page and used custom ...
LBos11's user avatar
  • 13
0 votes
1 answer
366 views

Use same page-mypage.php template for several pages

How can I use the same page-mypage.php file for different pages, without resorting to page templates?
Pim's user avatar
  • 1,142
0 votes
1 answer
32 views

How do I customize the post page

I'm currently trying to add an post page on my Wordpress website. I put my new post page as the default post page, on Settings -> Reading. The id of my page is 353. So I created a new php file named ...
Ivaalo's user avatar
  • 1
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
0 votes
1 answer
865 views

get_page_template_slug returns incorrect path

I'm currently experiencing a very strange issue which I can't find any reason to it. I have a theme which is working fine on all servers. Now, I have one client who is having issues with it. The ...
Benmay's user avatar
  • 361
0 votes
1 answer
34 views

Template for front page (latest posts)

I am having index.php -> This renders the latest post with sidebar page.php-> This renders the page layout : Templates are fullwidth,sidebarleft& sidebarright single.php-> This renders the ...
user avatar
0 votes
1 answer
43 views

Adding styles/scripts to specific page

I'm trying to add styles and scripts to specific template, But it's not working. In functions.php I tried: if( is_page_template('file.php') ){} if( is_page_template( get_template_directory() . 'file....
Bon's user avatar
  • 11
1 vote
1 answer
17k views

Custom page for WooCommerce's /product-category/

I am building a website from scratch on WordPress using WooCommerce. I'll be having products from numerous brands and to have an easier time organizing them, I've made each brand a category. Currently,...
stefanplc's user avatar
  • 113
0 votes
1 answer
876 views

Custom URL redirect in WP

I am trying to make my own redirect page for external link. My target My target is that, when a user open the link www.mysite.com/wp/GoTo/?URL=www.google.com, the browser open the page www.google....
Nicolaesse's user avatar
0 votes
1 answer
2k views

Inject class in body when particular page template is used

<body <?php body_class(); ?> > In header.php I have written the above code. But I want when this page template is in use: page-customer.php then body_customer class should go above. ...
WordCent's user avatar
  • 1,827
0 votes
0 answers
390 views

wp_logout() not working after form submission

I am pretty new to Wordpress, so please forgive me if this sounds like a silly question. I have a Wordpress Page which is using the default page.php template in my theme. I modified the page.php ...
Moose's user avatar
  • 292
1 vote
1 answer
41 views

Change content of page in child theme using plugin

I have a child theme in which I created a page template. I am able to show different content based on time of day by writing some PHP inside the actual page e.g. if ( $time < '10:00'){ echo "The ...
Abu Nooh's user avatar
  • 131
0 votes
1 answer
42 views

Plugin json page

From a simple plugin I have to create a page where to give data in json form. function create_page_json() { $return = array( 'value1' => '1', 'value2' => 'ok' ); $...
Afol's user avatar
  • 1
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
2 votes
2 answers
5k views

Custom Post Type slug same as page name causing a conflict

I have a Custom Post Type all set up. I would like the slug to be the same as a page name, because all of these CPT's will be queried on that particular page (/team-members). If I set the Custom Post ...
Joe's user avatar
  • 169
0 votes
2 answers
2k views

Change text size and color for tags and category meta description on product page

how can I change text size and color for SKU, tags, and category meta description on the product page? It's too big and bright. Takes too much place especially in the mobile version. Thanks!
Svetlana's user avatar
2 votes
1 answer
237 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

1
3 4
5
6 7
25