Questions tagged [templates]

Within the context of WordPress Theme-ing, the term 'template' refers to PHP files used to display content.

Filter by
Sorted by
Tagged with
0
votes
1answer
640 views

Header and footer fail to load with SSL and custom links

I have an existing site that I am now trying to secure, but I'm running into problems with the header and footer on the pages that are accessed via custom links in the menu. When I try to access a ...
1
vote
0answers
19 views

Get and insert order email address to the PHP template inside HTML text

I broke my head trying to solve the following case. I have a WooCommerce admin-new-order.php PHP template I want to customize. All I want is to add the order email address to the top of the email body ...
0
votes
0answers
16 views

Incorrect display of a page from a wordpress site

Opened a website on wordpress digitalelectronics.ru. As a result, I got the following incorrectly displaying site How do I get it to display correctly?
0
votes
1answer
11 views

Post template not applying on theme (potentially rendering as Page template)

I have a Post template, when I select it in the Post options, it saves, but doesn't apply the template on the frontend. Any ideas why this is happening? The posts in question are in the default posts ...
0
votes
1answer
11 views

Undefined get_header function

I installed wordpress according to the site https://ipipe.ru/info/ustanovka-wordpress-na-openserver and then wanted to use underscores.me, where I entered worldelectronics and pressed the generate ...
0
votes
0answers
24 views

Uncaught Error: Call to undefined function twentytwenty_the_post_meta()

I'm working with WordPress customization, I created a template who has the following code <?php /* Template name: Master Template */ get_header(); ?> <body> <?php if(...
0
votes
1answer
12 views

How to get custom page template being edited in gutenberg editor

I want to know custom page template name (the one chosen in page attributes - template) in PHP, before page opens in order to enqueue additional scripts according to chosen template. I know how to get ...
0
votes
1answer
29 views

How to add attributes to <body> tag when template cannot be directly modified

This is similar to How to add data- attribute to <body> tag but different in that I am n ow searching for a solution that does not require modifications to the template file. I have a ...
6
votes
5answers
28k views

Is there a way to change the default page template selection?

Click on "Pages" -> Click on "Add New" In the add new page screen. The default page template selected is "Default Template". Is there a way to change the default ...
0
votes
0answers
13 views

Are there any guidelines/standards for post styling?

I am a beginner in Wordpress Theme development. I have been trying to create my first theme and I have already started by adding some basic styling. I am using single.php as a template for loading the ...
0
votes
0answers
10 views

Default Template Selected After Changes in Elementor

I'm working with custom templates in WordPress. I'm using the Elementor plugin to build the site. When I open any page and make some changes in Elementor and then click the update button, I see that ...
0
votes
0answers
6 views

Modify the order to display: post title - thumbnail - excerpt for odd column?

Hi to all I'd like to modify my wordpress template (blog-entries category) to display starting from column4 and only for odd columns: 1) thumbnail 2) post title 3) excerpt. The now schema is title-...
0
votes
1answer
2k views

Deeply Nested Menu Loop with Twig using Timber

Using TimberMenu() and I have a menu for mobile that needs to go pretty deep. There must be a better way to write this with twig. Using macros and/or loop.parent or loop.index? It's basically this ...
1
vote
2answers
695 views

How to duplicate a page template but make minor changes to the header?

I will apologize in advance, I am very new to this. I have been teaching myself php as a hobby, but now I need it for work! I don't work as a web designer, but to try and save some money, I need to ...
0
votes
1answer
25 views

Is there a way to hook or call a custom woocomerce template that is not part of the default templates of woocommerce?

So I'm currently using Woocommerce and managed to figure how to override templates based on the documentation. Now I have a problem, so i managed to override a specific template let's say upsell.php. ...
0
votes
1answer
868 views

WordPress custom template not showing in the list of available templates

For some reason, my custom template WILL not show up in the backend of WordPress. I have tried the suggestions in this thread: Custom templates not showing up in template dropdown to no avail. It ...
2
votes
2answers
4k views

Passing variables to template parts

I have one template file videos.php which has the following line of code in it (aswell as a load of HTML): <?php get_template_part('loop', 'feed-videos' ); ?> inside that template part, I have ...
0
votes
2answers
298 views

Adding a custom page template to a plugin generated page

I have a page template, which is fully working throughout the website other than the pages where the plugin has generated a page such as a job description page, as the plugin that I am using is WP Job ...
0
votes
1answer
5k views

How to add an HTML <rel=preload> tag to the Header?

Since the google speed insights report suggests adding a < link rel="preload" href="/lity.css" as="style" /> to speed up the loading of the following resources https://www.myoutlet.lt/wp-...
1
vote
3answers
5k views

Change title only in dynamic page

I've been trying to change the title in a dynamic page without any luck. What I did is I created two page-templates from where I load items (occasions) from an external database. In one page-template ...
4
votes
1answer
1k views

How do I display two separate taxonomy archives for two post types that share a single taxonomy?

I have a custom content type, "products", which shares the category taxonomy with posts. We're using posts to discuss and review products. The idea is to have two separate URLs: /discussion/...
0
votes
0answers
12 views

Modify the loop template in a plugin

Is it possible to modify the output of a loop template from a plugin without using template_include to define a whole new template. My goal is to only modify the loop's output so that the plugin won't ...
0
votes
2answers
31 views

Timber + MtHaml, or any other HAML-like HTML shorthand

I use Timber for all my projects, but I would also like to start using a templating language like HAML or Pug. I found a PHP implementation of HAML called MtHaml, which supports twig. I thought this ...
0
votes
1answer
22 views

How to custom page template for the Gutenberg editor

I have read several questions/answers/articles about "custom templates," including the Block Editor Handbook, but nothing gets at what I'm looking for. Granted, this does smack of questions ...
0
votes
1answer
9 views

Removing a widget via theme editor

I recently updated our company's website and now we are seeing our newsletter sign-up widget appearing on landing pages where it previously had not. Our landing page template is set up to remove this ...
2
votes
1answer
973 views

Echoing Elementor page content in template, but it doesn't get styles and some widgets are missing

I built a page with Elementor, and I want to use it as my home page. When I use a static home page with my theme, it still gets wrapped with the header, footer, and content container, which I don't ...
1
vote
1answer
518 views

Set up Custom-Post-Type Author Archive

I’ve set up a custom-post-type on a site for jobs, and this all works fine. When I click on the author (my name) on the Custom Post Type though it goes to the archive.php file (as you can see in the ...
0
votes
0answers
15 views

Removing Yoast from Specific Template

We have a custom template, content generated by an API so no WordPress edit page, and Yoast is spitting out meta data that is based on our most recent blog post, so entirely unrelated to the custom ...
2
votes
1answer
13 views

Adding variable for post title so post template can include auto-generated link to view on external website.com/{post title}

There's an external website that I'll be referencing within my posts that uses the same static format for their pages. Let's say it's website.com/view/1111, website.com/view/1112, etc. What I want to ...
4
votes
1answer
620 views

Custom taxonomy query for a custom post type

I have a custom post type called news with a custom taxonomy called news category. Right now I have a template called taxonomy-news_category-press.php where press is one of the news_categories. The ...
0
votes
1answer
680 views

Why would adding a template file to a child theme cause an error in template-loader.php?

Per wordpress best practices, I created a child theme for an existing theme I have. Everything works fine until I try to add a template file which follows WP's template hierarchy conventions. For ...
0
votes
1answer
32 views

How to implement template file and the loop

I am trying to understand how to use a custom template file, in this case simply to list all posts. Based on my research, and initial responses to this post, the code looks like this: <?php /** *...
0
votes
1answer
16 views

How to get the most recent modified date of anything in the footer of my site?

I would like to be able to post the most recent updated date in my footer. However, I can't seem to find a way to do that globally for the site, just for each post/page at a time using ...
0
votes
2answers
3k views

Overwrite template-tags.php in child theme

I would like to overwrite some content which is located in (inc/) template-tags.php file on parent theme. Content need to be changed is in function footer_content_widget_area in template-tags.php ...
0
votes
1answer
22 views

Setting posts_per_page for taxonomy term template

I have a custom taxonomy term page set up to display posts associated with that term (taxonomy-insight_type-academia.php). I figured I could use the following to limit the posts on that page based on ...
0
votes
2answers
641 views

Creating custom post-listing templates in twentyseventeen child theme

I'm using a child theme based on 'Twenty Seventeen' and have created a custom post type ('review'). I want to make two Pages, one which lists 'reviews' and the other which lists a mixture of 'posts' ...
0
votes
2answers
2k views

Prevent private post 404

I want private posts (for those not logged in) to use the single.php template just as public posts do, at the moment they get thrown over to the 404.php template. I've had a good look through the ...
0
votes
1answer
9k 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,...
0
votes
1answer
608 views

How to Display Most View Post in the template file?

I need to create most viewed post column in the template file, but based on post view count? Function File function wpb_get_post_views($postID){ $count_key = 'wpb_post_views_count'; $count = ...
13
votes
3answers
12k views

Pass PHP variable to javascript

Is there any possibility to pass some PHP variables in javascript so I can use them later? Only in single.php. I heard about wp_enqueue_scripts but with that it is neccesary to declare a path to a JS ...
0
votes
0answers
10 views

Woocommerce default css

I am creating a custom woocommerce template I added in the various pages: header.php <?php wp_head(); ?> <body <?php body_class( '' ); ?>> footer.php <?php wp_footer(); ?> ...
1
vote
2answers
543 views

Apply custom category template to subcategories

Hello on my wordpress site I have a custom template for category A with slug (cat-a). I created a category-cat-a.php file to give this category a custom layout and this works without a problem. I am ...
0
votes
0answers
20 views

How to name custom search page PHP file?

I'm reading about how to create a custom search page. It's not clear for me how to proceed, in the wordpress documentation I've read that I can't use the name search.php for a search page because it's ...
0
votes
2answers
455 views

If Child or Grandchild of Page

I'm serving a different header in Wordpress depending what section you are within the site, 'residential' , 'business' or other by using the following code. Although i need to extend it to work with ...
0
votes
2answers
3k views

Rewrite rule shows 404 page

I am new to Wordpress so I don't really know how the rewrite rules should look like. My problem is that I have a custom template in my theme called portfolio-inner.php My rule looks something like ...
2
votes
2answers
17k views

How to customize search result page title?

I would like to customize the page title of the search result page: from: <title>Search Results for “search string” – Page 2 – Sitename</title> to: <title>“search string” result ...
0
votes
1answer
531 views

Show page title just from the first child-page in template

how can I do this: Pages: Home - sub-1 -- sub-sub-1 --- sub-sub-sub-1 On home-page should only show the page-title of the first child-page like: sub-1 I found this: <?php $child_pages = $...
0
votes
1answer
17 views

Conditional to determine if search.php page is the current template

I have a specific CSS-file for my search results, so the search.php template. I want a PHP if-condition to determine if the current template is the search.php template, so that I can load that CSS-...
0
votes
2answers
889 views

Create dynamic content from one WP page to multiple other pages

I want to create dynamic content that is taken from a specific paragraph from one page and writes to a paragraph on multiple pages that feature that same content. I am new to PHP and not sure how to ...
0
votes
1answer
736 views

Display content on Single page

I am building a single page theme, And I am having a problem with get_post_meta() The Problem This code bellow does not work, and I cannot see anything on the website as it's blank. Here is my index....

1
2 3 4 5
39