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
1answer
16 views

How can I delete the word `Category:` from page titles? [duplicate]

If I installed a new WordPress with twentysixteen theme and went to uncategorized page, I will see at the title something like Category: Uncategorized how can I remove the category: word from pages ...
0
votes
1answer
28 views

How can I add category variable inside posts?

I want to add a category variable along with the date variable that post has been published. For example, when I go to a post, I see the following under the post title: last updated on May 10, 2019 ...
2
votes
2answers
43 views

Load template file without a post type

Is there a way of loading a template file without having a post? I'm loading set of data via an API. Set up my index page but having a brain freeze with single template files as these posts are not in ...
0
votes
0answers
22 views

Child theme enqueueing style.min.css not style.css

Theme Name : StrapPress with bootstrap 4.2 I created child theme using Child Theme Configurator. It created functions.php and style.css, but when I applied new styles in the style.css it did not ...
0
votes
2answers
44 views

12 column grid layout

I'm Looking for a way to create the grid as on the pictures. A 12 columns based layout with a simple way to add text, images, video etc. etc. Tried the Bootstrap way without success. I’m up for ...
0
votes
1answer
26 views

Language file doesn't work (poeedit)

I'm trying to translate a WordPress template. I went to language files, then opened that copy with Poedit and started translating to my language (persian). After finishing the translation, I changed ...
0
votes
0answers
11 views

Custom Taxonomy 'archive' template name

I have a CPT with a custom taxonomy. So I have archive-projects.php single-projects.php for the CPT. That's fine. For the custom taxonomy I have taxonomy-project-categories.php Which I use to ...
0
votes
1answer
25 views

how to remove pages loading with the archive templates

I have custom post type "project", and it is loading with the template "archive-project". I already have a page "applications" to load "archive-project" So the same page is accessible via both URL's ...
0
votes
1answer
24 views

Exclude certain template from wp_list_pages

I'm trying to do something similar to the question in Exclude pages with certain template from wp_list_pages, but the $exclude variable doesn't seem to be returning the _wp_page_template value to then ...
0
votes
1answer
17 views

How to configure my blog page

I've been learning WordPress for about 2 weeks now and I've got stuck in the "front-page.php", "index.php" and "front-page.php" controversy. Here's my question.. How can I make the /blog use the home....
0
votes
0answers
21 views

Visual composer: can't use shortcode in template page

I need to add a visualcomposer this shortcode inside a category template page: [vc_row][vc_column][vc_basic_grid post_type="post" max_items="10" style="pagination" items_per_page="2" element_width="6"...
1
vote
2answers
78 views

Disable front-page.php template

I use front-page.php on my template to display home page. But I want to disable if the user uses another page for the home page from settings. Is there a solution? When user select a page from ...
0
votes
0answers
29 views

Accidentally deleted code in header.php

I accidentally deleted some code in my <head> section which made website header disappear. Later when add <script type="text/javascript"> header is appearing now but, when i try to open my ...
1
vote
2answers
141 views

Create Pages from Database

i've recently decided to create a website with wordpress. My goal is to a visualize data stored in a MySQL database. Each id in the database should represent one page on the website. From what i've ...
0
votes
0answers
16 views

How to Generate a Lot of Pages from a Database in Wordpress?

I have a page template that I have to use for hundreds of different products. I don't intend to create all those pages manually, and I want to know how to generate them automatically from a database ...
1
vote
2answers
42 views

Why do I get the same excerpt for all items in my RSS feed?

I'm new to coding and know next to nothing. I've done a ton research on the web, and I foudn the following code to import an RSS feed and place it in my template. The problem is that while I get 10 ...
0
votes
1answer
34 views

Merge multiple custom post types in a single archive template

I have multiple custom post types, viz., research, documents, booklets. I have a single archive template for each of them , archive-research.php, archive-documents.php, archive-booklets.php ...
0
votes
0answers
15 views

Why does a custom php code inside a custom template not get executed?

So in order to have some php code executed inside a page on wordpress there are 2 ways. One of them is to create a page template and when creating the new page in wordpress set the Page Attribute to ...
0
votes
1answer
14 views

Displaying Custom Page in front-page.php

Good day guys! I created a php file named test.php and i put a simple code <h1> Sample Text </h1> How to call my custom page to front-page.php just like how get_header() and get_footer() ...
0
votes
0answers
28 views

front-page.php includes a placeholder text field. How to get rid of it?

I have used front-page.php as a custom template for my site's home page. The page includes a page editor field even though I have coded the template entirely to use ACF Pro custom fields. The editor ...
0
votes
1answer
13 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
48 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
45 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
44 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
23 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
21 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
0answers
12 views

Woocommerce - Different product view based on user roles

I am currently working on a website for a client. He wants the products to be displayed in a table view for users with the ceratin role "resellers1" and "resellers2" and every other user will see the ...
0
votes
1answer
25 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 ...
0
votes
0answers
24 views

Show blog-posts on Template

Below you see the index.php of my Theme. As far as I understand, wordpress is using this file to generate category-pages with thumbnails, headlines, excerpts etc. So now I want to make a "special" ...
1
vote
1answer
50 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
24 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
33 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
vote
1answer
36 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
22 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
90 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
61 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
19 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
11 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
26 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
12 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
89 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
31 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
30 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
104 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
271 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
27 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
11 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-...