Questions tagged [templates]
Within the context of WordPress Theme-ing, the term 'template' refers to PHP files used to display content.
2,080
questions
0
votes
1
answer
13
views
In 2016 theme, how can I force all single attachment posts to use content-attachment.php rather than image.php?
Using 2016. For Search and Archive and Index, all attachment posts use content-attachment to display the excerpt... as expected.
But when I go to the actual attachment, it uses the image.php template. ...
0
votes
0
answers
41
views
Custom PHP Template in Twenty Twenty-Four
I am trying to use a custom php template in the latest theme and not only it has an file editor, there is no place for me to paste my template file.
This is a template file for a custom post type so I ...
0
votes
0
answers
15
views
Add block templates (html) via plugin for custom post type
I'm writing a plugin that provides a custom post type. I am currently trying to create the block templates for the "single" and the "archive" associated with the custom post type ...
1
vote
0
answers
28
views
Possible to overwrite load_template function in plugin using functions.php
So, I am currently using a Wholesale plugin for Woocommerce which, by default, redirects users to it’s own Wholesale Store page. The caveat is that the Wholesale Store page only uses the archive-...
0
votes
1
answer
18
views
Equivalent setup_postdata for Taxonomy Term?
I'm attempting to output a custom taxonomy term details (title, description, linked posts) in a modal but can't figure out the best way to 'setup_postdata' for that term so that my template functions ...
1
vote
1
answer
57
views
Wordpress post-template null warnings
I am getting these PHP8.0 Warnings from my WordPress site. The warnings are pointing to core code, not anything custom. When I turn debugging on there are no error messages on the site. I also checked ...
1
vote
2
answers
75
views
wp:shortcode works in block theme template file but not PHP include file
Block markup generally works in included PHP files. I prefer to use PHP includes in many cases as I can do more interesting things with it than I can with a template file (.html). I've just ...
0
votes
1
answer
256
views
Twenty Twenty-Four Theme, where to put the personalized CSS style rules?
With this new theme there seem to be no way to write CSS style rules that work.
CSS style files aren't loaded. and I find no space to modify CSS directly when editing the pages. But the "blocks&...
0
votes
1
answer
67
views
Post archive is not using the assigned template
Background:
In a custom theme's Settings > Reading > Posts page, I have designated all posts to be output on a page called "News and Events"
I created a new page which is blank except ...
0
votes
1
answer
121
views
How WP determines archive page vs single page?
I have a confusion about how WP loop works on archive pages vs single post or page? when you request an archive url, it shows all the related posts with only title, excerpt etc. but when you request a ...
0
votes
1
answer
25
views
Category theme template becomes default template for child theme
I am developing a child theme and have created a custom template for "category/ archives" page for a specific category
However, For some reason this custom template has become the default ...
0
votes
0
answers
75
views
Include theme header and footer in custom plugin
I am working on a custom plugin. I created a custom post type inside my plugin. Now, for single posts I want to serve a custom template using my custom plugin without touching any theme file. The ...
0
votes
0
answers
8
views
Template adding to the page
I work for the client, made the site and now I'm editing the dashboard and I need help from you guys, I edited dashboard for the client that when they want to edit stuff, they can go on that account ...
0
votes
0
answers
6
views
Add default meta data to a page/post template
Creating a Gutenberg template and populating it with default content is as simple as defining the initial content inside a file of the templates directory of a theme and the defining said template in ...
0
votes
1
answer
53
views
opening and closing elementor-widget-container
I want the following and hope you can help, I have created a container in Elementor and within this container I have added element and direction row.
I want to the container to toggle with a button ...
0
votes
1
answer
13
views
How to edit the new user email notification template
Hello :) I am hoping someone can help me resolve my issue or guide me in the right direction to resolve it. On my WordPress website, I would like to know how to edit the new user email template that I ...
0
votes
0
answers
10
views
Stripe Button not working on a custom post type template
I have a custom post type of "Properties", I am adding a stripe button on the template on this Property Post Type.
But when I click the stripe button, i get the following errors:
jquery.min....
0
votes
1
answer
112
views
How could I create real-time filtering in this case?
I have a "Library" page within my website, in which there are several "templates". Each of these templates has a "Category" assigned to it.
The difficulty is that I need ...
0
votes
1
answer
168
views
How to change the selected Template using javascript?
I'm using javascript in the editor to look at the content of the post and, if it contains certain strings, change the selected template.
Here's a picture of the form and the button behind it. The ...
0
votes
1
answer
195
views
How to check if a custom post type uses a custom template?
I have created this custom post type called books, and I already know I can select it with the condition tag is_singular( 'books' );.
But, is there a way to select with its custom template name, I ...
0
votes
0
answers
77
views
What hook runs wpautop on template content?
I have a shortcode that outputs HTML and I've inserted it into a single post template. The output gets extraneous <br/> and <p> tags, which I've read in other topics are likely due to ...
1
vote
0
answers
71
views
Copy a template part "header" that I want to duplicate and change a bit for a different page
Is there any way to "duplicate" a template part. I'm in FSE 2023 and I see a way to create new template parts however I don't see a way to duplicate them.
I need a way to duplicate a header ...
1
vote
1
answer
59
views
'global' not working when passing variable from plugin file to template
I have a custom plugin file that contains a function to generate a string upon the firing of a 3rd-party plugin hook. I want to echo this string in a custom template file — how do I give the template ...
1
vote
0
answers
56
views
Ship block templates or block template parts with plugins
Using the following code one can ship CLASSIC PHP templates for custom post types registered in plugins. An example for a custom post type named MOVIE:
function my_template_include( $template ) {
...
0
votes
0
answers
8
views
Every single link on my website opens to my last blog post
Every link has the correct permalink and I can see the correct page in the dashboard, but when I click on view page it goes to the correct permalink but shows the last blog article in the main body. ...
0
votes
1
answer
139
views
Unload templates; disable parent Template Parts using only "theme.json"
I'm currently creating a child theme in WordPress and I'm having trouble with template parts and custom templates from parent theme. In particular, I want to disable some of the template parts ...
0
votes
0
answers
49
views
change product menu dropdown with checkbox and external product variable creation
I'm trying to change the attributes menu of a variable product of woocomerce, I would like to change the dropdown menu into a checkbox menu, but there is nothing in the settings to change it.
Is it ...
0
votes
0
answers
29
views
Confused about editing the HTML in a template
So I set up a child template off of 2023 WP 6.2.2 ....
I then added my own template (Template one) however the thing i'm not sure of is how to do is edit the HTML of the template...
So a few questions:...
0
votes
1
answer
71
views
How to edit templates created in the block editor in code / template files not updating
I'm a beginner when it comes to PHP so have been building my page templates in the Block editor editor [appearance > editor].
But I've reached a point where I need to work in PHP/code (to make a ...
0
votes
0
answers
36
views
starter template custom page header issue
I am a beginner in WordPress and I am creating a website using a starter template.
The pages of the starter template have a background header but when I create a new page it is not showing as the page ...
0
votes
1
answer
34
views
How to provide page_template path in custom plugin using WordPress
How we can provide page_template path in custom plugin using WordPress?
I given a path in page_template='templatepage/checkoutpage.php' as array of post.Inserting post data by wp_insertpost() function....
0
votes
0
answers
337
views
Cannot register a block in my Twig-based theme using Timber for WP
I'm trying to configure my custom block theme with Twig templates using the plugin Timber 1.22 on WordPress 6
First, I disabled WP built-in rendering of templates/index.html in functions.php (...
0
votes
1
answer
52
views
How can I create an entirely new, separate display of posts?
I'm not even sure how to ask this question… :(
I want to create a new way to view my posts, where they are paged by weeks. (That is to say, a "page" is not a specific number of posts.)
I ...
0
votes
0
answers
8
views
how to create tempalte or page for taxonomy archive [duplicate]
i have cpt name X with 2 taxonomy "T1" and "T2"
i made these pages and every things work fine.
archive-x.php
single-x.php
taxonomy-T1.php
taxonomy-t2.php
now the problem is :
when ...
0
votes
1
answer
348
views
How can one use variables in a template or template part without polluting the global scope?
I'm a developer who is relatively new to developing in PHP for WordPress, and I am working on a WordPress site that has a considerable amount of custom code in the site's theme. I have been enjoying ...
0
votes
1
answer
216
views
Custom template is not showing up in templates dropdown list after re-naming it
I have a bunch of templates that I have in folders in my main folder. I know wanted to move all of these into a "templates" folder to make my code base more clean and easy to navigate. I ...
0
votes
0
answers
43
views
How to store page-{id}.php templates in custom folder
I'm trying to create a custom function on WordPress to store page-{id}.php templates in a folder named "custom-pageid-templates" inside my theme directory. Here's the code I'm using:
...
0
votes
0
answers
21
views
Wordpress template restored by mistake
I clicked on reset button of personalization wordpress page. Now my web template is restored by default.
How I can restored the template styles?
0
votes
2
answers
149
views
Create a page for each database table entries
I am creating a job board website(it is a part of the website). I have a JobOffer class with some rows in the database(added with it's form...). My problem now is to have a page for each of these ...
1
vote
1
answer
32
views
How can I produce multiple webpages with a different output based on one entry/Page/custom Page?
My problem:
I have a custom page format for events. Now I would like to get different outputs for each of these events.
Normal webpage › for visitors
Custom look › for easy copy and paste to other ...
0
votes
1
answer
184
views
Need Help With Making Full-Width Template for Blog Posts (common methods aren't working)
I've been researching this one for a while and can't seem to find the solution. But, I'd like to have a selectable template that I can use for certain blog posts to make them full-width by not ...
1
vote
1
answer
157
views
Dynamic header and footer template inclusion: footer script not included
I have a file that is being required by both the header and footer, and that file is meant to include the content for the footer or header dynamically.
So in my header.php and footer php, I only set a ...
-1
votes
1
answer
48
views
Homepage not loading correctly, only after refreshing
I'm working on - https://nhukr.org/
When I open the site first I don't see my last changes, sometimes, the site looks like it without CSS.
I cleaned the cache with different plugins. I disable caching ...
1
vote
0
answers
39
views
on attachment.php, how to display previous and next attachment links that follow the same order as a custom WP Query
Current behavior
I have a media page that uses a custom WP_Query to return all thumbnails of media library attachments (regardless of post parent) with a custom taxonomy of media_visibility that has ...
1
vote
0
answers
36
views
How to clone a theme template from within Wordpress? [closed]
I'm looking at the Raft theme and its got 8 templates, including one called Front Page.
I wanted to clone Front Page to 'Front Page Modified' so I could have on it and still keep the original in its ...
0
votes
1
answer
42
views
I reached halfway through a WordPress tutorial to find out I began wrong for a new comer to WP
Maybe this is not a code specific question, but rather a simple and important question for a new-comer to WordPress. Please guys begging to not downvote it.
So I was following a very good tutorial ...
0
votes
0
answers
86
views
Woocommerce template not working on newly added products
My theme templates dynamically create references to images, css classes, etc using the product's name. Pretty standard stuff... but recently, some of this dynamic content stopped working on any new ...
4
votes
1
answer
76
views
Theme template file for a specific custom taxonomy
Is it possible to create a template file specific for a custom taxonomy?
For example, I have music Custom Post Type and it has three taxonomies artist, album, and genre. So the hierarchy would be like ...
0
votes
0
answers
15
views
How to make a Template page to show the information of different things Shop and Product page?
Is there a way to make a page with multiple items (Like a Shop or products page) and a Single information page / Details page? I want to make a Custom template of a Single Details page that will open ...
0
votes
0
answers
273
views
Why isn't page attributes dropdown not showing up in a custom post type
After successfully creating a custom post type called events, I created a new template file to choose when creating event custom type page. But in the edit screen, there is no Page Attributes dropdown ...