Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [templates]

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

0
votes
0answers
14 views

post_content from grid builder template not formatted

Situation Using Visual Composer (WPBakery 5.7) I created a filter add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' ); function my_module_add_grid_shortcodes( $shortcodes ) {...
0
votes
1answer
22 views

Assigning alternate single-{cpt} template based on blog_id in multisite

I have a multisite network with some shared custom post types, and I'm trying to create a function that loads a custom single-{cpt} template for a given post type by $blog_id when defined, and ...
-1
votes
0answers
17 views

how can i improve my website ui ux? [closed]

I am going to create a website for web related services itevs . but I am confused when I am starting to build this. i think my UI/UX sense not good. how can I improve this? give me some idea how can I ...
2
votes
1answer
21 views

Is there a way to add template suggestions to WordPress?

In a nutshell what I want to achieve is this: If slug equals foobar serve the foobar.php template. I know I could do this with page-foobar.php but I don't want to create a page for this. add_action(...
0
votes
1answer
13 views

add_filter function concatenate string and locate_template function

I am trying to inject a small php component to the end of my main site navigation. I have written this filter: add_filter('wp_nav_menu_items', 'add_css_switcher', 10, 2); function add_css_switcher(...
0
votes
1answer
26 views

wp_trim_words() does not trim the_content() in WordPress

In my WordPress website, I want to show a short text of each blog_post on the custom blog template. I want to show a Read More button with a link to the post at the end so a user can click on that ...
0
votes
1answer
9 views

Customize categroy catalog page

In "appearance > customize > woocommerce > product catalog" I choosed to display the categories for the shop display page. This wokrs fine and the categories are now shown on the main shop page. BUT,...
0
votes
2answers
27 views

underscore template dynamically remove row Jquery

I have this underscore template to add and delete row : <# jQuery( document ).ready( function() { jQuery( '.add-ingr' ).click( function() { jQuery( '#re-ingr .ingr' ).append( '<div>&...
0
votes
1answer
18 views

Is it possible to access plugin data from a custom feed template?

I'm trying to use current_user_can in a custom feed template (created using add_feed) to check if they have a particular Memberpress membership plan in order to access the feed, but while I can get ...
0
votes
2answers
10 views

Add to cart is not visible in product page

Anybody know how to make the "add to cart" visible on product page? I did an update of content-product.php and after that the add to cart and choose style options are gone. Please check the link below:...
0
votes
2answers
20 views

How can I make custom page templates work on child theme?

I have created a page template called concert.php under page-templates directory with the following content: <?php /* Template Name: Concert*/ add_body_classes('page_concert'); /* Custom ...
0
votes
0answers
10 views

How do I force a CPT to select a shared custom template in Post Attributes?

I have a custom templates that is used by several custom post types. This code forces the CPT singles to display on the front end using it: function get_custom_post_type_template($single_template) { ...
0
votes
0answers
58 views

is_tax not working for custom taxonomy

I am trying to over-ride a custom taxonomy file from my plugin. Actually, I have 2 custom taxonomies: destination & activities. I have successfully over-ridden the taxonomy template for activities ...
1
vote
1answer
24 views

Edit css for search results page

I have a search results page with a template call content-search.php. Basically what this file does is to display the results after a person searches something on the search bar, and i would like to ...
0
votes
0answers
26 views

How to insert my custom taxonomy template via plugin?

I've created a plugin to manage my bookstore site. In this plugin, I've created a custom taxonomy call "authors" to manage book authors. I want to display archives of Authors, so I've created a ...
1
vote
1answer
42 views

Is it possible to access Gutenbergs reusable blocks in CPT block templates?

What I am trying to do is to use specific Reusable Blocks, that are editable by certain admins in the back end, within block templates for custom post types. So if you register a CTP or edit the ...
0
votes
1answer
87 views

How to render WP Rest-API Endpoints in a React.js Theme with Woocommerce

I am building a Ecommerce Wordpress/Woocommerce Theme using React.js. I am using the npm package: create-react-wptheme This package renders the react app directly inside of the index.php of the ...
0
votes
0answers
19 views

Custom post template

Hi i want to create a wordpress template of custom post name is album. I want to show posts By grouping $Q1 = jan,,feb,mar $Q2 = Apr,may,jun same for Q3 and Q4. Now when i click on Q1 then it show ...
0
votes
1answer
16 views

How to create dynamic templates?

So let's say that I have a navbar template with the following content: // template_parts / navbar.php <nav class="navbar navbar-expand-lg dark bg-transparent fixed-top" id="mainNav"> <div ...
0
votes
1answer
18 views

Wordpress site not loading styles on desktop?

I've created a Wordpress website using Astra and Elementor. I haven't coded any of it or done anything manually other than using the editor to edit some template blocks. Now, when I try to load one ...
0
votes
1answer
10 views

If is_page elseif is_page not working like I want it to

My code looks like this: if (is_page('mounting-guides')): $guides = get_field('guide_pdfs'); elseif (is_page('user-manuals')): $guides = get_field('user_manual_pdfs'); elseif (is_page('cleaning-...
2
votes
1answer
11 views

Query children and parent title

i'm query child pages of a page ID. How can i echo the parent page where it says "PARENT TITLE ? Using <?php echo get_the_title( $ID ); ?> is not an option. <?php $args = array( '...
1
vote
1answer
25 views

What is this code trying to do? It was the cause of my 20s TTFB

I was troubleshooting a 20-30s TTFB for a Wordpress Theme with the help of the fabulous Query Monitor. I was able to narrow down the cause to this code: #e0e950# error_reporting(0); @ini_set('...
0
votes
0answers
11 views

Homemade global template, advice?

For the theme I’m using there is a hook for an area just above the footer section and here I would like to output different ”banner sections” that are ”prepared globally”. So for each ”banner section”...
0
votes
0answers
22 views

index page link tag injected with wrong href attribute

Recently when I've updated my wordpress site to the latest version, the website has become incredibly slow because stalling occurs when trying to load a corrupt href link: the href attribute should ...
0
votes
1answer
27 views

Filter dropdown in users.php “delete user” bulk edit screen

I recently attempted to delete an administrator user. Using the bulk editor, I selected "delete" and was presented with the option to assign their content to another user. However, the dropdown ...
0
votes
1answer
29 views

Custom Archive Template for Multiple Categories

I want to create a custom archive template for two post categories. One of my categories is events, and the other one is courses (I have more). I already have a custom template for events (category-...
0
votes
1answer
11 views

How to display specific child page template in wordpress

I am trying to display a child page template of a certain specific parent page. <?php if(has_children()){ // This is a parent page get_template_part('content', 'parent'); ...
0
votes
2answers
20 views

Using Includes in Templates in Document Head

In a template, I have a need to include_once an external PHP (an include.php) that contains functions that I need to use inside the template. Included in those functions are CSS styles and an ...
0
votes
1answer
18 views

Set og:image programmatically in custom single post with external images

I have created a plugin with a custom post type and the single post template pulls in photos from an external site. I would like to programmatically set the source for one of these images as the og:...
0
votes
0answers
31 views

create-guten-block in wordpress theme?

I'm working on a wordpress theme and want to replace my shortcodes with gutenberg blocks. I'm new to working with blocks but having looked into it a bit I've decided to try and use create-guten-block ...
1
vote
0answers
29 views

Is there a way to create a block template that is not limited to a post type?

So, I have been reading up on block templates and from what I understand, they limit the ability to create them to one per post type. I just need to be able to add groupings of blocks without having ...
0
votes
0answers
12 views

Calling custom fields value for pages to another page

I'm trying to include a product template in my header.php file and i want to get a custom field value on header from product page. I have added properly when i need to get custom field values from ...
0
votes
1answer
18 views

How to include any template using Shortcode fuction?

function custom_code(){ return include( get_stylesheet_directory() . '/custom-template.php'); } add_shortcode('custom_shortcode','custom_code'); As you can check above I want to include a ...
0
votes
1answer
8 views

Display all page which have not a certain template

I'm trying to display all pages of my website which have not the following template: template-rubrique.php. It works great but it doesn't output the blog page as well, since it doesn't have a template ...
0
votes
1answer
15 views

How do I find a way to create a global single.php for a custom post type?

I am working on making a custom post type plugin for my website. However, I want to make it universal for any theme I may decide to change. Or to be able to append the post type to a single post file ...
0
votes
0answers
12 views

Template for Custom Post type with Custom Taxonomy for a particular Term

I am creating a custom post type with its own custom taxonomy. I then want to create two different templates. Post with a particular Term in the custom post type show one template and the remaining ...
1
vote
1answer
55 views

How to replace WordPress sidebars (widget areas) with Gutenberg

I'm trying to build my first Gutenberg theme, and I want to build a page template with the layout as shown below: Pre-Gutenberg I would have built widget areas into the page template to create the ...
0
votes
0answers
37 views

How to add variables to a template

I am using a query argument detail to check if a custom template should be loaded. This works fine, but I also need to add some variables that can be accessed from within the template. Here I am using ...
0
votes
0answers
24 views

Change Page Template Based on URL Rewrite in WordPress

I have created a custom post type author when it takes to single author details it was working fine. For example http://localhost/author/james/ It was showing single-author.php file. My question is ...
1
vote
1answer
14 views

Having trouble with Template hierarchy. I Need to create a set of pages that drill down from states to specific locations

I am creating an interactive set of pages that needs to be very easy to navigate, as the audience skews older. Walking through the flow The user will start at a page, that lists all of the (US) states....
0
votes
1answer
27 views

How can I add text to a specific 'Edit Page'?

I have a specific Page, that I do not wish to be edited. As such, I would like to place a 'Do Not Edit This Page' message within a specific 'Edit Page' file as follows: Any ideas on how this can be ...
0
votes
0answers
117 views

Change WooCommerce template for PDF - access to custom field

I want to do some modifications to a template of WooCommerce, but I'm rather ZERO in PHP, so that is why I'm asking some guidance so I could perform my small modifications, which I'm sure are not too ...
0
votes
1answer
8 views

Disable theme WooCommerce template [closed]

Just purchased a premium WooCommerce-read theme. Unfortunately, this theme comes with a /woocommerce folder. How can I disable this templates,without deleting whole folder?
1
vote
2answers
48 views

How do I create a custom partial / template?

I have created an sign up form and placed it in my header: <div> <h5 class="myapp-sign-up-text">Sign up for updates</h5> <form class="myapp-email-form"> <...
0
votes
1answer
134 views

How can I modify the default reset (lost) password email text?

I found some similar questions on here, but was unable to apply the solutions that were provided. The standard password reset email that Wordpress is sending does not provide a clickable url for ...
-1
votes
1answer
29 views

Second Loop Showing Only One Post on Single Post Page

The single.php page I am working on was able to display two loops successfully, the first being the actual page's post, and the second loop displaying the last 5 posts. However, since I have styled ...
1
vote
1answer
69 views

Gutenberg & Pre-formatted Templates: Core Block Attributes

The Gutenberg Handbook currently has a short entry for creating whole templates of blocks, e.g. used for Custom Post Types or just pre-formatting posts. https://wordpress.org/gutenberg/handbook/...
-1
votes
1answer
154 views

custom post type single page template not working

I created a page portfolio and select template Portfolio Template My portfolio page does not access the template-portfolio.php file. In which also includes content-portfolio.php in template parts ...
1
vote
1answer
48 views

Only one post is showing on category page, why?

My website categories are only showing one recent post, not all. category.php code looks like this: <?php get_header(); /** * The template for displaying Category pages */ quality_breadcrumbs()...