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

BuddyPress : how can I call the template Wordpress would have chosen (template hierarchy)?

playing with BuddyPress here ! I made some new user profile pages, and when I display the content, I want to make a new posts query, and display the loop. Thing is, I want to display that loop using ...
0
votes
1answer
118 views

Template files not working for archives and categories

I added category-news.php template file to the theme directory but it doesn't apply the template of the category but instead to the index.php file. category-slug.php is the highest level of the ...
0
votes
1answer
1k views

Opening a JQuery modal window on click of a button with a JQuery plugin

I am trying to open a Jquery Modal window on click of a button. And inserting this Button into a plugins content template (WP SHow posts). I'm using jquerymodal.com's modal code, since I don't need a ...
0
votes
0answers
412 views

Display a custom 404 page without a redirect

In a plugin I want to display a specific page without redirecting (and thus without changing the URL) like the plugin https://wordpress.org/plugins/404page/ does. I can capture 404s and redirect them, ...
0
votes
0answers
273 views

Why wordpress custom template comments shows Undefined index?

During making a custom template comment I see this notice: Notice : Undefined index: comment_field in C:\xampp\htdocs\..\wp-content\themes\..\functions\comments-html.php on line 155 Following is my ...
1
vote
1answer
166 views

How to display (plugin?) output on a single page (not a widget, probably not a short code) - template, plugin, combination?

I've seen many variants of this question but none of the answers I've found yet have answered my question. Not new to PHP but new to WP and yes I've read a lot of docs. So this is where I'm diving in ...
0
votes
1answer
44 views

Advice on creating a WP Archive Template with Custom Taxonomy (get_term_meta)

I have created some custom taxonomies (using WordPress Pods) and they work great - but there's just one thing that I need them to do, and here's my question: How do I go about creating an archive ...
1
vote
1answer
127 views

Custom url structure for custom template

I have a custom taxonomy called activities and a custom role called operator. So, if example.com/operators/bird-watching is visited then I want to list all the operators that offers bird-watching. ...
0
votes
1answer
364 views

How do I add a text input field for customers to leave a note on a single WooCommerce product page?

I'm constructing a little webshop using WordPress, WooCommerce and a theme called Storefront. I would like to add the ability for clients to add a custom note for the product vendor on the product ...
0
votes
1answer
49 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 ...
0
votes
1answer
128 views

Prevent 404 and serve custom template for custom URL

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
51 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
4k 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
28 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
184 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
78 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
29 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
31 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
31 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
384 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
405 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 ...
4
votes
1answer
947 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
1k 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
20 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
234 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
27 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
58 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
101 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
40 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('...
1
vote
1answer
357 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
275 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
20 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
63 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
448 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:...
1
vote
1answer
183 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
101 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
1answer
99 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
9 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
20 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 ...
2
votes
1answer
339 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
230 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
73 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
18 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
44 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
982 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
181 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
590 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"> <...
2
votes
1answer
13k 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 ...
0
votes
1answer
41 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 ...
3
votes
1answer
419 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
3 4
5
6 7
39