2022 Developer Survey is open! Take survey.

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
0 answers
11 views

How to get rid of undefined variable in previous post image

I am working on a website on WordPress and I have it set to where the bottom of the post will automatically link to a random previous post with a picture from that previous link but a notice keeps ...
user avatar
  • 1
0 votes
1 answer
49 views

How do I get the trackback count of a post in wordpress without writing an SQL query?

How do I get the trackback count of a post in wordpress without writing an SQL query? I tried searching Brave Search and I couldn't find anything helpful. To fetch the amount of comments a post has, ...
user avatar
  • 101
0 votes
1 answer
20 views

Post and page content not displaying in search results

I am using a content-search.php template part to output my search results. The post/page titles and links to those posts/pages are working correctly, but for some reason the the_content() function is ...
user avatar
0 votes
0 answers
17 views

Best practice for getting stuff like wp_head() without echoing it [closed]

So this question is related to this one I have WordPress with Twig and I need to include the return of wp_head in my head.html. However, wp_head() echos its contents, instead of returning it. Sure ...
user avatar
  • 101
0 votes
0 answers
19 views

How to loop specific Category menu from archive page?

I'm trying to loop a specific product category menu from the archive.php page and the category has 4 columns or as a 4th Tree How I can Loop it here in ul ? <ul><!-- 1--> <li&...
user avatar
0 votes
1 answer
18 views

How to set a template with wp_insert_post

I'm trying to set my template to the Elementor Canvas when using wp_insert_post but it isn't working. It is creating the new page fine but not using the canvas. What am I doing wrong? { "action&...
user avatar
1 vote
2 answers
69 views

Can we use a webservice with Wordpress?

Assuming that my site uses a database through the web service to fetch content, style and other things for my site. Can we make this connection in a way provided by the CMS? A plugin does that? Should ...
user avatar
1 vote
1 answer
32 views

WordPress Loop inside Loop?

I'm using ACF, and displaying the Brands CPT. Inside of brands, I will want to setup a separate loop for posts containing certain tags. My loop works, meaning that I'm able to access the brands and ...
user avatar
0 votes
0 answers
20 views

Taxonomy archive uses incorrect template when query strings are used

I have two taxonomies in use on my site, both of which have their own taxonomy archive templates with different interfaces. I use query strings to perform filtering on each of the archives. My problem ...
user avatar
  • 1
1 vote
0 answers
17 views

Can I add a default Block to my custom theme?

Lots of plugins provide both shortcodes and PHP for adding elements... either directly in a page or post, or programmatically in a theme template. Is there a process for adding a Block, like Latest ...
user avatar
0 votes
1 answer
16 views

Create a custom posts page

I've created a template that shows all my blog posts. But the issue was that this page slug (tips-and-tricks) wasn't added to the URL of the single post. Solution: I've selected this page as my blog ...
user avatar
  • 125
0 votes
0 answers
11 views

How to get all template files used for rendering a single post/page?

So, I need to debug an issue and I would like to see all template files that were used to render this specific page. I mean specific "sub" template files (not the main .php file), like sub ...
user avatar
  • 116
0 votes
1 answer
26 views

Why is a wp function used in current PHP namespace's callback not resolved to global scope?

Imagine the following script: <?php namespace MySpace; class MyClass { public static function execute() { // Do something post_exists(1,'','','my_post_type'); } } ?> I'm now ...
user avatar
  • 286
0 votes
0 answers
12 views

How do I set the Stewart Search Template to return only published posts in the result

I recently took a WP.com online webinar and the moderator referred me here to ask my question. I am trying to redesign my site using FSE. I am using the "Stewart" theme. I have added a ...
user avatar
  • 1
0 votes
1 answer
29 views

Does wordpress templates always in files or in database?

I have theme and in header.php and I found this templates (see attached screenshot). But there is no content directory in template directory. Even I searched for those files (header-private.php and ...
user avatar
0 votes
0 answers
13 views

Include last post date in get_categories loop

I have a simple get_categories loop on a template page which works fine to display a list of categories within the parent category 52 (as shown below). I would like to also display the last post date ...
user avatar
  • 1
0 votes
0 answers
37 views

In a WP_Query can I force the results' is_singular() to be set to false?

I have a custom page template that includes a basic query after the main content. like this: $myPosts = new WP_Query( array( 'post_type' => array('post', 'contentTypeA', 'contentTypeB' ), ...
user avatar
  • 141
0 votes
0 answers
32 views

How can I disable an attribute from a Gutenberg block included in a template via InnerBlocks?

So I have this block that I created using templates and InnerBlocks, it's a block that my authors will use to insert a Hero Image section at the top of the page. export default function Edit() { ...
user avatar
  • 111
0 votes
1 answer
30 views

How can i get the code of Shop Page Woocommerce?

I'm trying to write the codes of the shop page in woocommerce, especially in the main div All of them are inside div with class-main, and I want to know how I can create one by myself with the ...
user avatar
0 votes
1 answer
33 views

How to get and set the post tag value within WP Query from URL?

This is new grounds for me. I'm on a hunt trying to figure out how can use a WPQuery to list all posts, that are filtered by the tag which the user clicked on. So for example if the end-user is on ...
user avatar
  • 708
0 votes
0 answers
13 views

Wordpress Template Reverts to default template after changing

I am experiencing a problem regarding wordpress page template. after I change the wordpress template to "Home Page", it reverts to default template after update. I tried installing WP Super ...
user avatar
1 vote
2 answers
29 views

Best Constant to use to check if WordPress is running

I have a program that can run standalone (outside WP) or inside WP. If the program is running 'inside' WP (via a custom template using appropriate enqueue scripts and add_actions), then there is a ...
user avatar
3 votes
1 answer
105 views

Problems with Layout inherit in theme.json

I have in the theme.json of my FSE theme the following lines in the code: "version": 2, "settings": { "layout": { "contentSize": "840px&...
user avatar
0 votes
0 answers
16 views

Create custom page to author.php

How can i add new pages to author page? normal url is like https://www.example.com/author/exampleUser i wanna make a settings page located in like this: https://www.example.com/author/exampleUser/...
user avatar
0 votes
0 answers
21 views

Please help me clear my confusions about WordPress

I am building a website in WooCommerce. What is most efficient way to replace the original theme site template pictures? Do we replace them with same size and pixel pictures and nothing wrong will ...
user avatar
0 votes
1 answer
27 views

Can't split the_title() by white space

I am having issues splitting the_title() by white space in my template. $title_split = explode(" ", trim(the_title())); and (from here: https://stackoverflow.com/questions/23206953/split-...
user avatar
0 votes
0 answers
16 views

Loading Elementor templates in a Bootstrap modal on button clicking

I'm trying to load Elementor templates in a Bootstrap modal on my homepage, I've already linked the Bootstrap and I can load the modal when the button and modal content are on the same page without ...
user avatar
  • 1
0 votes
0 answers
10 views

WordPress 2022 template, how to see the blocks added in post template on post edit?

I’ve created a post template in 2022 theme. In this template I’ve added an image block. I’ve assigned this template to the post. Where (and how) do I upload the image in the post edit? On Post edit I ...
user avatar
  • 121
0 votes
0 answers
68 views

Is it possible to set archive.php instead of index.php to display blog?

I have index.php and archive.php in my theme, but I'd like to using archive.php to display blog and category posts. Is it possible to override index.php by archive.php?
user avatar
  • 1
2 votes
0 answers
53 views

How do you override Post template when using Query Loop block?

Seems like an impossible task to override how posts are rendered in Query Loop block (grid). Default block level controls enables styling but not overriding of markup. I just want to apply HTML5 ...
user avatar
1 vote
1 answer
22 views

Automatically add custom CSS to new posts using a category template

I have inherited the task of modifying a Wordpress site (using a child theme). I'm a designer, not a code or back-end expert. I have been customizing a set of pages on a site to have alternative ...
user avatar
1 vote
1 answer
57 views

how to display search term in the template full site editor

i am building a template for the search page (in full site editing, therefore html and no php), and i want to have a search results heading. i have this: <!-- wp:group {"layout":{&...
user avatar
  • 113
1 vote
0 answers
26 views

Remove post templates from the selection box menu when creating a single post

I added some post templates(not coding, using block editor) and now I can't find any options to delete those unnecessary templates.
user avatar
  • 11
0 votes
1 answer
14 views

How can I trace inconsistency in loading a template?

I have two (almost) identical wordpress websites. A devel/local and a production/remote. I have a custom post type "event" created through Meta Mask on both instances. I want to render a ...
user avatar
0 votes
1 answer
28 views

How to specify a template for a path like http://example.com/something?

I created a custom post type ('explore') that we use in the site. The pages for this section live at http://example.com/explore/page-name These pages work just fine, but if a user were to back out of ...
user avatar
  • 113
0 votes
1 answer
23 views

How to insert "get_template_part()" based on Category ID?

I am trying to insert a part of my template into a Category Archive page. How would I go about that? I guess I'd need something like this: <?php $catarray = get_the_category( $post->ID ); ...
user avatar
  • 985
0 votes
0 answers
23 views

Editing my loop-page.php causes posts to show on all pages

I am working on a project where I needed to list out blog posts when I hit a particular page. Originally I was just using the base code in my loop-page.php file. To do that I was using: <?php ...
user avatar
  • 101
0 votes
1 answer
213 views

How can I display the number of post associated to a category in Twig/Timber Wordpress? [closed]

I am using the following code to access my categories. $orderby = 'name'; $order = 'asc'; $hide_empty = false; $cat_args = array( 'orderby' => $orderby, 'order' => $order, '...
user avatar
  • 3
0 votes
1 answer
17 views

how to set social icons to product / post template (Auros theme)? [closed]

After installation of the Auros theme, the social share icons are unfortunately not loaded in the product and the post template. It should be loaded like this via the template: Do you have any idea ...
user avatar
0 votes
1 answer
21 views

How do I custom a page that doesn't exist in the page list?

Many custom post types have their own archive page which doesn't exist in the page list, but I am able to customize these pages by finding the archive's template file. But for some other instances, I ...
user avatar
  • 117
0 votes
1 answer
166 views

Timber - Twig post.content returns null can't create ACF Gutenberg blocks

I'm using Timber for a Wordpress site and I'm trying to start and build Gutenberg blocks. The blocks work in the backend editor but I cant get them to work in the template. In fact nothing from the ...
user avatar
0 votes
0 answers
23 views

How to turn my WordPress site into a ready to deploy template?

I have a wordpress membership site, where users can login/signups and manage their accounts. I was wondering if it's possible to convert this site into a ready to deploy template which I can download ...
user avatar
  • 1
0 votes
0 answers
29 views

How to list posts from a sub-category that is listed in a parent category (more details below)?

I have an unusual situation I put myself in. I'm making a custom theme and I want to display a list of subcategory posts with its own URL like this: https://domain.com/category/sub-category So far, ...
user avatar
0 votes
1 answer
24 views

Using is_page_template inside loop

I have tried this: <?php $query = new WP_Query( array( 'post_type' => 'my-post-type', 'post_parent' => $parent_id ) ); while ($query->have_posts()) : $query->the_post(); ...
user avatar
0 votes
0 answers
26 views

how to display a template.php in a shortcode

I have created a template in WordPress page-example.php, which has HTML, javascript, php I would like to use that template in a shorcode Any way to do it? I have this code but it doesn't work for me: ...
user avatar
  • 3
0 votes
0 answers
22 views

Render page with specific id from functions.php

How can I render a page from functions.php with a specific page id? I tried something like this: $template = locate_template('page.php'); if ($template) { set_query_var('page', get_post_meta( 200 )...
user avatar
0 votes
2 answers
29 views

How to identify and hide/remove an element from a WordPress page [closed]

I created my first WordPress website using Elementor and an all-in-one theme called Webify. Since I am new to WordPress and to website design, I've imported a demo website that comes with the Webify ...
user avatar
  • 101
0 votes
0 answers
10 views

Taxonomy Template displaying different color post tag js

How do I add the classes to my existing class in my taxonomy page. Currently my existing taxonomy page will list the post belonging to the category. My individual post i will show the info and post ...
user avatar
1 vote
1 answer
120 views

Display "large" image size and show caption in attachment page

On the attachment page for an image, I'd like to display the image in its "large" size. The current behavior is showing the "medium" size image. I'm using a theme I created from ...
user avatar
  • 146
0 votes
1 answer
18 views

How to allow WordPress to recognize a custom URL segment after a product URL and use a custom template?

Essentially I'm trying to allow a URL like this: https://example.com/products/my-product/test I'm using WooCommerce, my product base is /products, and the product name would be My Product here. I want ...
user avatar

1
2 3 4 5
41