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
1
vote
1answer
21 views

Creating a custom archive template that sorts post by date

My site's default archive sorting is set to alphabetical, which I am happy with. However, I want to create a custom page template so I can also have an archive page which sorts all posts by date. I'm ...
0
votes
0answers
22 views

How to create dynamic URLs on WordPress?

I have a site where users can download freeware software. I want to create a dynamic download page. How to prevent the https://example.com/software-name/download/ URL from returning 404. /download/ is ...
0
votes
1answer
18 views

Change archive page template using pre_get_post

I've used pre_get_post to modify and display my custom post type in an archive page with pagination which uses my custom created archive template, see here. It it displaying the posts exactly what I ...
0
votes
1answer
35 views

How to enqueue CSS and JS only on specific template?

I'm busy with my home.php template and I need a few CSS/JS files that are only loaded on that specific template. I tried doing it with if ( is_page_template( 'home.php' ) ) { //ENQUEUE CODE }, but ...
0
votes
0answers
28 views

Adding a page to custom post type hierarchy?

My custom post type has the URL Structure "/work/post-name" The default archive is disabled with "'has_archive' => false" and replaced by a WordPress Page called "/work/&...
0
votes
1answer
15 views

Can i forget about the post loop inside the page template?

A simple page.php template often looks like this: <?php /** * The template for displaying all pages * * This is the template that displays all pages by default. * Please note that this is the ...
0
votes
0answers
18 views

For custom templates, is it better to use `template_include` or `type_template`?

I saw a lot of questions about including custom views in Wordpress (I mean custom templates). There were many answers. Some people recommend using template_include and others recommend using ...
0
votes
0answers
14 views

How can I edit a php custom page template to work in other themes?

How do I edit a php custom page template to work in another wordpress theme? Do I just have to take out the header codes or do I have to edit a whole php page? Header area Thank you for any input. ...
0
votes
1answer
19 views

How do I find out which (page) template file my custom child post is looking for?

I am trying to make something like a web-app with WP. One of the issues I'm facing now is that I cannot find out which page template file my post is looking for. I have looked at template file ...
0
votes
1answer
15 views

Enqueue script if not page template

I'm using the following code in functions.php: if ( !is_page_template( 'page-full-width.php' ) ) { wp_enqueue_script( 'flickity-js', get_template_directory_uri() . '/js/flickity.js', array(), ...
0
votes
0answers
82 views

Edit (advanced) customs fields on page template

OK I'm freaking out a little bit here :) Step back. I have to make some changes to a wordpress website (with a custom template) that I "inherited" from another guy, which developed it in 2015 and ...
1
vote
0answers
22 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 ...
1
vote
2answers
36 views

How to enable template page only for a post id page

I wish to limit the possibility to use a specific template page only for post id x I have created a page-blog.php template and I want it usable only for the post id 115 (id of my blog page). ...
0
votes
0answers
42 views

Mutiple url rewrite rules and get every params

I am creating a messaging system where I have 4 sections (1)inbox (2)sent (3)draft (4)unread so I decide to go with Wordpress add rewrite rules I already add one rewrite rule section. ...
0
votes
0answers
12 views

WordPress Page hierarchy ( parent is singular of custom post types slug ) is returning not found

I have a custom post type called CASINOS with slugs is casinos wich has _archive set to false and I have a page called Casino with slug casino ( singular) The problem is when creating a child with a ...
0
votes
1answer
12 views

Conditionally check if page is using template from plugin directory

I am having trouble loading the script conditionally in my plugin. I have a DataTables page and want to load datatables scripts only for that page. So I made a page template called datatables-...
1
vote
1answer
24 views

Custom template with CPT doesn't display on frontend

I created a WP plugin which adds a CPT and allows user to select custom template. It was working when I used an MVC design but when I moved to a new MVC style it doesn't output on frontend and seems ...
0
votes
0answers
10 views

Nest HTML content between template part

Apologies for the lackluster title. I am curious if there's something similar in Wordpress as Nunjucks call or block. Essentially, I am curious if it is possible to create a template part and inject ...
1
vote
2answers
23 views

How do I style Wordpress pages differently based on the tag used?

I was thinking this might be done by adding custom CSS to a page template. I have a page template like this: <?php /* * Template Name: Grafy Full Width */ /*add_filter('...
1
vote
2answers
19 views

How do I find the directory of a page template?

This must be a very amateurish question but... I'm using page templates from the dropdown menu in page editor but I can't find their source code. I know that usually this can be found in themes/"...
1
vote
1answer
63 views

Add custom admin menu item for pages using a certain template

I am looking to add a new, custom menu item to the WordPress admin sidebar that displays pages that use a certain template. For example: a group of pages uses the template called "Retailer Sendout" (...
0
votes
1answer
15 views

Swap out a page that is a parent to a many many pages

I have a specific page on my site and I'm experimenting with some changes that are too complex to have a backup (page template change, custom fields etc). I duplicated the page using a plugin and ...
0
votes
0answers
24 views

Custom WooCommerce template for product

I've created a specific product template for a few of my WooCommerce products. However not all of the plugins and WooCommerce JS files load on this page. I assume it's leaving out some default headers ...
0
votes
0answers
14 views

how to create going/interested button for event listing website - wordpress

I am building an event listing website in WordPress. The theme already has almost every basic features that i would require except button like event interested/going, by which I can record attendees ...
0
votes
1answer
48 views

How can I create a button that when clicked populates a div with a list of foods that are checked as a certain type of ACF?

I have not asked any questions here before so I'm sorry if I do it wrong. I am new to custom theme template files. I am new to wordpress and php also. This is a learning exercise for me. I am making a ...
0
votes
0answers
26 views

Order custom metabox in diferent page templates

I have multiple pages created with a linked custom template. I have installed the toolset plugin that allows creating custom fields and linking them to page templates. Each page has different groups ...
0
votes
1answer
50 views

How to edit woocommerce sub-category page

I am trying to make a product listing site using WooCommerce. Now the system is when someone clicks on any category, they go to the subcategory page. I want to add a sidebar with all product ...
0
votes
2answers
44 views

How to create first post, fifth post full width, rest in three columns and so on

I am new to wordpress development, I am leaning how to make a theme from scratch. I don't want to use any plugin to achieve this. How to create first post/ fifth post/ ninth post full width, rest in ...
0
votes
0answers
21 views

How to call a plugin function from front end form template and plugin class

I have a template with a form and three inputs, then I load this template from the plugin class. how can I retrieve $_POST[''] variables from that form in plugin class. I can successfully have ...
1
vote
1answer
23 views

Is There A Way Of Using the_post_thumbnail() to Pull In A Specific Image From The Media Library

I currently have a custom theme with some images in a separate image folder and I pull them into the frontend with the echo get_theme_file_uri('/img/image-name.jpg') which works as expected. I would ...
0
votes
1answer
21 views

wp_redirect goes to infinity loop

I want to redirect WordPress pages as per location e.g domainname/ar, domainname/fr etc, but the code goes into an infinity loop. Here is the snippest: function redirect_location(){ //$...
0
votes
0answers
19 views

Custom Post Type with Template - Template is not used

i created a custom post tpye function ABECrm_post_type() { $labels = array( 'name' => __( 'Agenden', 'ABECrm' ), 'singular_name' => __( 'Agenda', 'ABECrm' )...
0
votes
0answers
17 views

Media attachment page - custom URI, and trying to display differing links, based on that URI

I'm trying to edit the "media attachment" template. I have four image galleries, each one with a different URI. I want the media template to reflect the gallery in a link in the page. The media ...
1
vote
1answer
74 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 ...
1
vote
0answers
23 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 ...
0
votes
0answers
66 views

Proper way to dynamically load content based on url slug Wordpress

I am trying to set up a page template that can dynamically load content to the page based on the url slug. For example: https://example.com/cities/indianapolis/ loads data specific to Indianapolis and ...
0
votes
1answer
28 views

How to render an element, that was saved as a template, using a hook?

My goal is to render one identical element on every page. At the moment this element is manually added to 50+ pages. I saved it as a template named 'reusable' and then i want to call it from functions....
0
votes
1answer
34 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', ...
0
votes
1answer
77 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 ...
1
vote
1answer
21 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 ...
1
vote
1answer
164 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 ...
1
vote
0answers
20 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]+)/?'...
1
vote
1answer
18 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 ...
1
vote
1answer
144 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 ...
0
votes
0answers
16 views

Creating a page/template by inputting content into a form

I would like to create a page in Wordpress by inputting the content into a form field. Here is an image of what I am talking about: Instead of me having to create the page manually and formatting it, ...
0
votes
0answers
103 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 ...
0
votes
1answer
70 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 ...
0
votes
0answers
37 views

Get template name (slug) in function.php

I have post filtering by taxonomy, everything works is good, but i want return another html dependence on page template. If this is page "about us" return another html tag. This is my working code, ...
0
votes
0answers
27 views

How to Refresh Page Template Settings

Is there a method to refresh the page template settings when a new layout is dictated? I just changed the top-level pages of www.rodwellbuildingservices.com master menu such as page ...
0
votes
0answers
24 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?

1
2 3 4 5
23