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

template with multiple post loops for multiple widgets [duplicate]

I have two different widgets on one of my pages. They both display posts, but from different categories. One widget has pagination. Now when I switch to another page, the 2nd widget doesn't display ...
0
votes
0answers
17 views

Display metabox galleries on specific page template in admin editor

I'm building a Wordpress website with two metabox galleries displayed only on post type page in admin editor. What I'm trying to do is to display them only for a specific template page in the admin ...
0
votes
1answer
28 views

How does post loop integrate individual page elements

I am just trying to understand how coding in Wordpress works. I have read a bunch of tutorials about post loops and how to modify them with queries, but I have no idea how individual page content I ...
0
votes
0answers
20 views

Spoof the admin panel on the client side?

I'm working on some admin dashboards with a plugin that uses shortcodes that are not available in the admin panel (can't use do_shortcode() - I tried). However these are dashboards that I really want ...
0
votes
0answers
16 views

Woocommerce shop page showing blog posts

For some reason the /shop/ url is showing the blog posts and blog posts archive template. There isn't a page-shop.php in the theme, only the woocommerce/archive-product.php and woocommerce support is ...
0
votes
0answers
14 views

How to correctly submit a form using ajax from a custom plugin's template

I want to submit a form from a tamplate to my custom plugin but I always get a bad request 400 response. What is the correct way yo do something like this? My form: <form id="entry_form" ...
0
votes
1answer
17 views

Random home page at each refresh between array of page IDs

I am trying to rotate 3 pages as my home page at refresh. Currently I am using this in my functions.php: <?php function my_homepage_redirect() { if ( is_home() || is_front_page() ){ $...
3
votes
1answer
97 views

Custom taxonomies, with custom rewrites/slug, AND loading a taxonomy archive template from a plugin

I think maybe my understanding about rewrites and templates for custom taxonomies and CPTs is wrong and maybe someone here could help me solve my problem and educate me. So I have a post type, "...
0
votes
0answers
8 views

Attribute Posts to User via Custom Field Value

I have a custom user role on my website "reviewer" of which one can view an archive page, just like a normal author, where published posts are attributed to that user and displayed in ...
0
votes
0answers
26 views

Change the meta keywords for a specific page

I would like to change the for a specific page only. Is this possible with wordpress? Currently I have set the keyword in a section of the template I am using which applies for the whole page. ...
0
votes
1answer
46 views

Can't print Yoast meta description into page template (syntax error, unexpected '.') [closed]

Here is the relevant portion of my page template code: $yoast_meta = get_post_meta($post->ID, '_yoast_wpseo_metadesc', true); function my_service_template_footer_data() { echo "<script ...
0
votes
1answer
24 views

Wordpress template page name displayed on screen

Hi there _ Must admit I'm scratching my head! I've uploaded a demo site that uses a number of template pages. Everything works as expected, but whenever there's a page change the top 3 lines of the ...
0
votes
1answer
11 views

Display WordPress archive template page in 3 columns and not 1 column [closed]

I'm trying to achieve the following: Currently WordPress display them in 1 column: Is there code I can Add to the template file, to display all the blog post in this grid layout
0
votes
1answer
50 views

Create page template via functions.php?

I want to create a new selectable page template for users that will allow them to identify which pages on the site are "Service" pages (eg plumbing, gas fitting, etc). The template is an ...
0
votes
1answer
47 views

Make page template that is just an “include” of another?

I would like to create a page template in my child theme called "Services". This template is identical to page.php - except that I just want to add some JSON LD (ie, https://schema.org/...
0
votes
1answer
58 views

Changing the HTML of notices in WooCommerce [closed]

I'm creating a WooCommerce theme from scratch, and I'd really like to change the HTML that wraps the default WooCommerce messages on the Cart and Checkout pages. I am specifically talking about the ...
0
votes
1answer
36 views

How do I change the template specifically for single posts?

My goal is that when someone clicks on a post, the page they are taken to has no sidebar cluttering the view. I want them to focus on the content. I only want the sidebar to appear on the homepage, ...
0
votes
1answer
19 views

Run do_shortcode on php template using JS function

I want to run a shortcode using the [jobs] on my PHP template. I'm using the WP Job Manager plugin. A sample code: <?php global $post; $company_name = esc_attr(urldecode(get_query_var(...
0
votes
1answer
26 views

Home page not loading after editing header.php file

My sites home page has lost all the content after i added a line of code for Google Analytics-Global tag in the header.php file. I took the backup of the file before i did the change and have restored ...
0
votes
0answers
16 views

Can I style a single post of a certain tag - in the archive and on its own page?

I want to post just one-line quotes in my blog, under the tag "quotes." I would like these quotes to show up in my archive as JUST quotes, without the time stamp. Same for when you click ...
0
votes
0answers
20 views

Mobile Menu and Mobile Sidebar missing

My mobile menu and mobile sidebars are not working. When I click on the icon it only adds a # sign to the url and nothing happens. I have deactivated all the plugins and activated them one by one. The ...
4
votes
2answers
123 views

How can I make the wordpress editor apply the selected template?

I wrote a WordPress theme for a non-profit where I use templates to style individual pages. I select the template for an individual page in the editor on the right: For styling of a template page, I ...
0
votes
0answers
15 views

Advanced Custom Fields “Flexible Content” to not echo header if layout is unused

My website allows front-end users to create posts, they can add quotes, highlights and sources for their content. I am using Advanced Custom Fields "Flexible Content" for the user to add as ...
0
votes
0answers
9 views

Do not trigger page 404 on custom template

I have created a template and managing all the pages from my index.php <?php $splitUri = explode('/', $_SERVER['REQUEST_URI']); if($splitUri[count($splitUri) - 1] === "") array_pop($...
0
votes
0answers
21 views

Post template with breadcrumb needs to show page navigated from

I have a custom post type, Reports, that contains many categories (custom taxonomies). These posts are organised in menus on different pages. So a menu page named "Best Reports" would have ...
1
vote
1answer
34 views

2 Templates 1 custom post type according url

Let's say i have a custom post type names "Projects", is it possible to have two template like : Minimal template (with a few info about the projet) Complete template (all the info) And ...
0
votes
0answers
16 views

Unsure what to name my Post type Category Template

I previously was using the woocommerece product_cat on my taxonomy-product-cat.php page, But now Im making a separate post type called Productzs. So the annoying bit about this is the template needs ...
0
votes
0answers
24 views

Wordpress keeps switching back to empty template

I've created a custom page template with a hero and a subnavigation section that fetches some data from custom fields and shows a menu. Here's the code: <?php /** * Template Name: Hero Page ...
0
votes
1answer
22 views

How do I get tags linking to proper pages (/tag/sample-tag -> pages with that tag)

(Warning: WordPress newbie ahead...) I have a WP site with a bunch of posts, many of which have tags associated with them. However, clicks on links to such tags -- https://example.com/tag/sample-tag) ...
0
votes
1answer
106 views

How to hardcode header and footer in WP?

I am playing with optimizing a site built on Divi. I'm thinking that rigidly embedding the footer and header will have a positive effect on page speed - just not quite sure how to go about it. I don't ...
0
votes
0answers
9 views

Add an archive and single template for a CPT within a plugin

Is it possible to have a custom post type's archive and single templates within a plugin, rather than within the theme? i.e. archive-course.php and single-course.php?
1
vote
0answers
15 views

How to create 'Local' filters for WordPress srcset sizes in template parts?

I've read a bunch of tutorials on how to create filters for srcsets and srcset sizes, but they all appear to be applied globally, with a fixed width or set of widths for sizes. The trouble is, I pull ...
0
votes
1answer
21 views

Template part including not working

I have since tried a blank and new php file and accessing it the same way - that worked. So I am now unclear why the existing file does not load at all. There are no errors. Here is the code start of ...
0
votes
0answers
64 views

how to echo a background image in a custom post type

I've setup a loop for custom post type // The Query $the_query = new WP_Query( 'post_type=support_medewerkers&posts_per_page=1' ); // The Loop if ( $the_query->have_posts() ) { while ( $...
0
votes
0answers
28 views

Parent/Child themes - both CSS files loaded

I am trying to use child themes for the first time in Wordpress - and I've got it working (at least from a user's perspective - it functions correctly) My concern is that both the parent and child CSS ...
2
votes
1answer
38 views

Is there a way to loop through a shortcode datasource to create a table?

is there a way to loop through a shortcode data source created in a custom plugin like followed within a 3d party frontend design plugin? function bs_test_fnc(){ $aData = array( ...
0
votes
0answers
30 views

What are the advantages/disadvantages of ways to use php template files?

I saw people using php files template parts that are basically php files with no (or very little) logic, that only insert/echo the dynamic content in the respective places. Maybe using the ternary ...
0
votes
2answers
33 views

Is there a more efficient way to loop through pages?

I have a site that uses a set of 3 images for the header of its subpages. Each page has a different set of images. From what I could find, my best way to accomplish this would be to place an if ...
2
votes
1answer
38 views

How does wordpress blocks?

Couldnt find an answer on this one so thought id ask here. So you have pages which are a post type, On each page you have the post_content which in my case - Is just a bunch of other blocks, Eg in SQL ...
0
votes
0answers
82 views

YITH Wishlist Template Table Layout

Need to adjust the wishlist.php template layout as below displaying only medium image with name & price below (example: https://imgur.com/a/8rYy4SS ) I have tried editing the template but seems ...
1
vote
1answer
27 views

Templating of a specific post ID

I'd like to know it's possible to do something like this single-post-45.php I needn the post(45) only to have a custom template. I know we can achieve this with page, like this page-45.php or by a ...
0
votes
0answers
16 views

Content not showing properly with the first load of the page

As i am building my website with Elementor, i noticed that certain pages (almost all of them) are showing the first time not quite properly. For example, I set a black background for a section and ...
1
vote
0answers
13 views

How can I turn a custom wordpress page into a product page?

I want to create a custom wordpress template product page using PHP. I don't want to override the default product page, but I want to register my custom template page as a product page. I have created ...
0
votes
0answers
43 views

Reposition Product Variation Field

I have created a custom field for variable products. I need to reposition the custom field data.variation.custom_field as shown below: https://imgur.com/a/A8aSHbH How can I reposition my custom field ...
0
votes
0answers
14 views

Change the “Show All” button in a Wordpress Portfolio Filter

I'm working on a website for a client; https://www.lingvox.services/ and I'm trying to solve an issue on this page https://www.lingvox.services/mobila-la-comanda/ The client is Romanian, and wants the ...
1
vote
0answers
32 views

Redirect template based on permalink rather than $wp_query

I'm trying to separate out different templates which utilise WordPress' search (s query var) along with different post types. Situation 1: Default WordPress search page (search.php). Example: example....
1
vote
0answers
13 views

What is the filter or hook to add admin controls to posts on the front end?

What is the filter or hook that would allow me to add a custom control (an action link) for admins next to "Edit" on posts on the front end? I want to give admins the option of carrying out ...
0
votes
1answer
12 views

Page header on specific page is different from the rest [closed]

I've been trying to solve this for ages now. I finally resorted to asking. I am using a theme and I have created a child theme. Everything is working fine, except the that one page uses a completely ...
0
votes
0answers
20 views

Where do I edit what the user sees on my Wordpress site?

I'm currently learning how to create a site using Wordpress purely with code. I can't seem to find the file where it displays the content of my site (text blocks, image blocks, shortcode, etc.) in ...
0
votes
0answers
33 views

Check if current post in loop is last on current page

I am developing a WordPress theme and want to determine if I am at the last post of the current loop page. <?php get_header(); ?> <main id="main"> <!-- ======= Blog ...

1
2 3 4 5
40