Questions tagged [theme-development]
Themes create the public (front-end) interface for a WordPress site.
4,428
questions
0
votes
0
answers
148
views
woocommerce remove coupon link does not work
Woocommerce remove coupon link does not work in custom cart page:
Here is code my Code:
<div class="report-text-cntr-cart row mr-0 ml-0 <?php echo ( WC()->customer->...
0
votes
1
answer
29
views
Why am I getting a different filename? And how does WordPress load singular.php for both Page & Post? (Fresh WordPress installation)
I installed latest XAMPP & extracted latest WordPress
to this path: C:\xampp\htdocs
I activated default theme: Active: Twenty Twenty
I created these:
1 Page called test: http://localhost:82/...
0
votes
0
answers
151
views
How can I add a field for featured image on backend of a custom Taxonomy?
I came accross this problem when trying to create a new wordpress Theme,
I want to add a custom term field for featured images on the backend of a custom taxonomy,
I have followed this tutorial and ...
1
vote
0
answers
35
views
Not able to select width of blocks inside of cover block
I am using a blank theme with the theme.json for gutenberg blocks. When I create a cover block and select any block inside of my cover block it doesn't give me the option the select the width ...
3
votes
0
answers
61
views
Can I customize any WordPress parent block-based theme template files by child theme like a parent classic theme?
Usually, I can replace the template files and PHP codes of any parent classic theme with child themes. Since block-based theme templates rely on HTML, how can I replace parent block-based theme files ...
0
votes
0
answers
93
views
Woocommerce AJAX filters option loading spiner - problem on mobile device
I've got quite weird problem. I built product filtering options, sometimes the server is slower so I wanted to add a loading spinner while you wait for the results. I only managed 50% because it works ...
0
votes
1
answer
50
views
Any way to change/add to the theme name dynamically?
I'm currently working on a site with coworkers and our way, since we have only one staging, is to have 4 times the theme. The master branch in git, and we got each our version of the theme with the ...
0
votes
0
answers
54
views
PHP inside echo HTML
I am a little bit confused about the following code:
i need to add span class="<?= $styles['core']; ?>"
<?php
if( ! defined( 'CP_VC_ACTIVE' ) ) {
echo '<li><span class=&...
0
votes
1
answer
63
views
require_once not working in plugin wordpress
I'm creating a plugin and I have to add some custom controls through the plugin. Here is the code for the custom control defined in featured-types.php -
function ...
0
votes
1
answer
12
views
WordPress Animation Adjustments
I have a problem with my WordPress animations. https://cyals.com is the website Currently developing. I Use Elementor Page Builder to build my page. a man and a woman load with animations one by one ...
1
vote
1
answer
32
views
How to render a time-of-day string like '16:42' with a site's chosen time format?
I have a need to display a time-of-day value in a site's chosen time format.
For example I have 16:42:18 and want to display it as 4:42 PM if the time_format option is g:i A, or 16:42:18 if the ...
2
votes
0
answers
356
views
Wordpress Block Theme: Customize meta viewport
I am building a custom Block theme and I need to have this meta viewport in my <head> :
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, ...
0
votes
0
answers
14
views
Available widgets is not showing up?
I have added theme support in functions.php file.
add_theme_support('widgets');
And register the menu still no available default widget.
class Sidebars{
public function __construct(){
$...
1
vote
1
answer
62
views
Should action callbacks start with a verb?
class Singleton {
public function __construct() {
// Case #1
add_action( 'woocommerce_before_shop_loop_item', [ $this, 'open_product_wrapper' ], 10 );
add_action( '...
0
votes
1
answer
37
views
Getting white screen of death on category pages because of body_class() function
Category pages "example.com/categeories/blah" were working fine and then suddenly started showing white screens.
Debug showed no output. No errors in apache logs either. So I started ...
0
votes
0
answers
2k
views
Uncaught TypeError: extract(): Argument #1 ($array) must be of type array, null given
My WordPress site is using a custom theme written by a third-party. I am getting the white screen error on my pages saying There has been a critical error on this website.
In attempt to diagnose the ...
0
votes
1
answer
28
views
Trying to link to a php template file but its blank
From this Stack Overflow qestion It shows a bunch of ways to make page templates. But I don't want to use a page template that uses Gutenberg.
Is there another way to make a PHP file like a tos.php, ...
1
vote
0
answers
54
views
How to check if a WordPress core block is active in sidebar
I have a widget area and I want to enqueue a stylesheet only if a core block is active in it. I tried the following code:
// if has audio block.
if (has_block('audio')) {
wp_enqueue_style('audio-...
-1
votes
1
answer
713
views
can't add EVENT LISTENER to a element
I'm trying to add a click eventListener to a element in homepage, it doesn't work. the event is not even added to the element.
the above picture shows the html of the homepage. where I wanted to add ...
0
votes
1
answer
36
views
Why my theme's css not working on another site
I work on my on theme based on Neve theme. First I had problem with scripts, because not working but i had to change their location from footer.php to header.php to everything was good.
New some ...
0
votes
1
answer
36
views
How do I use wp_nav_menu?
I try to add dynamically a menu which structure of css ul/li link look like that
<ul class="navbar-nav ml-auto">
<li class="nav-item">
...
0
votes
1
answer
271
views
Custom post category name showing empty
I have a custom post type and category. I have the below function on my page. I am getting the post but I am not getting the category name on the page.
I am getting the empty array
array(0) { }
...
0
votes
1
answer
52
views
How to store the third party script with HTML code in the wordpress custom input field?
I have created a custom field on my custom post. Below is the code I am using for the custom field.
<?php
function wpt_add_thirdpartyvideo_metaboxes() {
add_meta_box(
'...
0
votes
1
answer
70
views
How to access index file in Block Themes?
I'm new to wordpress code and read that index.php is located in the root/themes/yourtheme/index.php.
When I open index.php in the twentytwentytwo folder in my wordpress directory, it sais that block ...
0
votes
2
answers
28
views
Getting Same Description in All the Custom Taxonomy Posts
I have developed a custom taxonomy post type. I have displayed categories & inside categories posts/(products).
I am getting the Post title & Image as they should be (which I add), but the ...
3
votes
2
answers
135
views
Hide 2022 Parent Theme Templates / Parts
I'm playing with the new FSE and 2022 theme. I made a child theme and know how to create my own custom template/block parts but how can I hide the parent theme template I don't wish to use like ...
0
votes
0
answers
834
views
getBoundingClientRect() showing different values on load vs scroll
I'm working on a site for a client and trying to implement custom parallax functionality. I have used the following code -
var inView = function(element) {
// get window height
var ...
4
votes
1
answer
341
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&...
0
votes
1
answer
237
views
get main URL from subdirectory with php
I have a WordPress site that contains multiple subdirectory installations of WordPress with individual databases inside one WordPress installation, and I want to link them together in the themes. But ...
0
votes
0
answers
48
views
How to separate two columns from one content on a page template?
I am just creating my first serious web project built on Wordpress and during my task (basically learning by doing) i came to a following problem. The designer wants to show two columns of text on ...
0
votes
0
answers
141
views
Widgets are not displaying in the admin panel
I am using WordPress, I have an issue with the widget. I am not getting the widget in the WordPress admin panel.
I am getting the error in the console
Uncaught (in promise) TypeError: null has no ...
1
vote
1
answer
47
views
Add, edit specific CPT with custom role
Who can help me with roles and capabilities?
I am stuck on this and I need some help.
I want a role that only can add, remove edit etc. a specific CPT.
What I have so far
add_action('init', function(){...
0
votes
1
answer
96
views
Api rest_route 404 while building filter for custom posts (filtered by multiple meta keys / custom fields)
I am working in a WordPress site that has many custom post types, and extensive use of Advanced Custom Fields (ACF). The site also uses node modules, custom code from scratch, and Git in favor of a ...
0
votes
1
answer
73
views
How to copy page/post from one theme to another?
I was using default wordpress 2022 theme and created few post & page templates from Appearance -> Editor -> Templates. These templates are lost when I switched to a child theme. Is it ...
1
vote
0
answers
26
views
custom taxonamy and post type
I have a little problem with showing of my taxonomy template my codes to create custom post type are:
function setup_projects_cpt(){
$labels = array(
'name' => esc_html_x('Projects',...
0
votes
1
answer
168
views
How to display posts from a certain category in a bootstrap 5 carousel loop with multiple items?
I am a newbie developer who is still learning, and at the moment I am developing my very own first wordpress custom theme. However, I am struggling to get this working. I Have a "Hero" ...
0
votes
1
answer
219
views
how to get this tax_query working?
I have wp_query including custom taxonomy terms which works if all the fields have values. Otherwise, it is giving 0 results.
This is the form that is used to get the taxonomy terms.
Based on the ...
1
vote
2
answers
278
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":{&...
0
votes
1
answer
32
views
Not sure how to debug this npm install error. This is a wordpress theme that comes with a built-in gulp/webpack task automation [closed]
So I downloaded and installed this theme that comes with a built-in gulp/webpack task automation. I went over to the project folder (wp-content/theme/themename) and just ran npm install but I got this....
0
votes
0
answers
19
views
How do you create a custom category widget that you can style?
My first time developing a WordPress theme, and I'm having a hard time understanding the widgets portion of it. Mainly because of my limited understanding of PHP.
This is what I want my categories to ...
0
votes
2
answers
738
views
What is the best way to define constant options for a theme?
By constant options I mean properties of the theme that don't change during every day use in production, but are changeable by the developer primarily for reusability purposes. Things like custom ...
0
votes
1
answer
29
views
How to specify a template for a path like http://example.com/something?
I created a custom post type ('explore') that we use in the site. The pages for this section live at http://example.com/explore/page-name
These pages work just fine, but if a user were to back out of ...
0
votes
0
answers
132
views
Permanently deleted posts still exist
So, I deleted multiple post of type page (sent them to trash, went to trash and permanently deleted them), but one of my functions didn't work like it was supposed to so I went and investigated, it ...
1
vote
1
answer
17
views
Show notice just below the search form on the themes page
I want to show a notice on the theme installation page. I have used the admin_notices hook but it is showing the message above the search box.
I want to print the notice at the place of a black line ...
0
votes
1
answer
160
views
How to update mark-up of a gallery block in a custom theme?
I’m developing a custom WordPress theme and it’s my first time working with WordPress in a little while. I can see the post and page editor has been completely overhauled, and posts and pages can be ...
0
votes
2
answers
83
views
Why would you use esc_attr() on internal functions?
I see a lot of these in premium themes/plugins.
#1 - Why would you escape this? It's your own data. For consistency?
function prefix_a() {
$class_attr = 'a b c';
// Some more code.
...
0
votes
0
answers
117
views
How to show comments from different Plugins to same post type?
I have two different comments, but both are related to the same post type.
The first comments in this way:
<?php
if (isset($_POST['submit_tickets'])){
$tickets_reply = $_POST['...
0
votes
2
answers
90
views
Extend Wordpress Core Classes in OOP Theme?
What is the best way of using WordPress's core classes in the context of an object-oriented design?
I am trying to use $wp_admin_bar to remove a couple of the default WordPress designs but I am not ...
0
votes
1
answer
86
views
Getting the category title / description returns first matching post?
I'm working on a template-part called heading which displays the page heading and an optional subtitle underneath. I have it working on pages, but on archive pages like our blog or product category ...
1
vote
3
answers
150
views
No matching template found when using single.php
I am building my own WordPress theme. I have the front page working. However, when I try to view a test post full of Lorem Ipsum, I get the "No matching template found" error.
I have the ...