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
4 views

Display ACF category image on archive and single template files

I have written this function to display an Advanced Custom Fields image custom field added to a specific category (News) in WordPress. This image displays on the category archive page and all of the ...
user avatar
0 votes
0 answers
8 views

On click some element i want to use some template

I have a page that calls the template, I made filters using a data-filter.These filters sort out the ALU door and PVC doors. However when I click on the pagination and goes to page 2 to list the other ...
user avatar
0 votes
1 answer
18 views

Image loading function not working on archive.php template

I am using the following function to display a post thumbnail or ACF custom field image depending on the page type being viewed. This function is loaded from the inc/template-tags.php file in the ...
user avatar
0 votes
0 answers
13 views

Custom post type set default template using block editor

So i am using the block editor to build a page and I created several custom post types. Usualy I would Just create a template in the classic way but since i want to use the block editor i was ...
user avatar
  • 101
0 votes
0 answers
30 views

How to redirect template_directory to subdomain relativ url?

I use subdomains with the same template and I try to use filter template_directory to replace serverName by $_SERVER['HTTP_HOST'] but it doesn't work . The default page is www.website.com and the ...
user avatar
  • 11
0 votes
0 answers
8 views

Custom template - query issues

I have developed a custom template for a woocommerce and for filtering categories and taxonomies i use the WOOF - WooCommerce Products Filter (paid version). I contacted them because when i load a URL ...
user avatar
1 vote
1 answer
47 views

How to render a block from php template

forgive me a question that may seem stupid, but has been keeping me busy for hours: I'm trying to insert a gutenberg block into a category php template, but neither the render_block () function nor ...
user avatar
1 vote
1 answer
30 views

Plugin custom post template; without overriding all posts

I've created a plugin and I am trying to include an post template that the user can optionally use. I've tried the following, add_filter( 'template_include', 'insert_my_template' ); function ...
user avatar
0 votes
1 answer
23 views

Hook a script as the very last one before the closing body tag

I'm trying to add a script in the very last position before the closing via function.php Other scripts are hooked by other plugins, so WP is placing my script as the firts one of the list. Like: [my ...
user avatar
1 vote
1 answer
41 views

How do I assign a block template (.html) to a custom post type?

I'm using WordPress 6.0 and I've created a child theme from TwentyTwentyTwo. I've created a custom post type using code like this: register_post_type('foobar', [ 'public' => true, '...
user avatar
  • 595
0 votes
1 answer
18 views

Add an anchor link to a 'plain' HTML file, without over-writing the entire site?

I have a simple site where WordPress provides the general look-and-feel, and overall page structure, but the important pages are actually plain HTML, styled by Bootstrap. These are manually created in ...
user avatar
  • 27
0 votes
0 answers
33 views

get_children() Archive Template

This is my first attempt at coding & I have come unstuck with the wp_query loop integration. I just want to build a template for a page that will check for children and list their respective ...
user avatar
  • 1
0 votes
2 answers
54 views

When are Shortcode Attributes Available in Template

I have a template that adds a shortcode. The add_shortcode is at the top of the template, before any template output. Note that any attributes for the shortcode are optional. I don't care if they ...
user avatar
0 votes
0 answers
16 views

Getting Shortcode Attributes befor content is displayed by the template

This regards getting the shortcode attributes to be used in a function called after the shortcode is defined, in a template. The page that uses that template has the shortcode plus attributes, as in [...
user avatar
0 votes
0 answers
11 views

Is it possible to create custom links inside a template?

I'm creating a template for a custom post type with the URL structure of TEMPLATE ONE mysite.com/firstname1-lastname1/ mysite.com/firstname2-lastname2/ ... etc I also have pages from a custom post ...
user avatar
  • 1
0 votes
0 answers
14 views

How Add Code in Page Index Custom Template?

I want to display a code in a Custom Page (Index-sitemap) created in the theme folder. But when I use the following code it just shows up on the Homepage. if(is_home() && ! is_front_page()) { ...
user avatar
0 votes
0 answers
16 views

How to save template data into wp_post table (post_content column)

Is there a way to save template data into wp_post table? I made a custom template that automatically makes tables and some sentences with the meta-data that users insert in. I wanted to make users ...
user avatar
0 votes
0 answers
25 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
56 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
22 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
20 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
38 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
111 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
33 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
21 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
21 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
17 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
58 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
  • 359
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
30 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
16 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
1 answer
59 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
87 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
34 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
63 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
  • 718
0 votes
0 answers
15 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
32 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
4 votes
1 answer
189 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
17 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
31 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
28 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
12 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
128 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
70 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
33 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
87 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
42 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
15 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

1
2 3 4 5
41