Questions tagged [theme-development]

Themes create the public (front-end) interface for a WordPress site.

Filter by
Sorted by
Tagged with
0 votes
1 answer
208 views

Hide Heading if ACF Field is empty

I am trying to add a "Local FAQ" section to all the individual location pages on a site with literally thousands of individual location pages. I am doing this by using ACF field in the ...
0 votes
0 answers
47 views

Change the behaviour of a button

I'm using Flatesome theme and I have a use case that I need to refresh the page after closing the popup, I'm wondering if I can change the behavior of the close button in Lightbox Popup so instead of ...
0 votes
0 answers
45 views

WP_Query order posts by category

In a custom WP_Query I want to order posts by category. I mean that I want to show posts with term_id=1291 first and then show other posts. when I use two WP_Query , I cant use pagination. "...
0 votes
0 answers
28 views

Is there any way to store single.php wordpress file into a php variable

I am finding an way to store single.php file in a variable in wordpress file, I want to use preg_match_all to this file. $regex = "~(<h([2-6]))(.*?>(.*)<\/h[2-6]>)~"; $...
0 votes
0 answers
26 views

Woocommerce Variable Product Dropdown for Custom Shop Template

I'm building out a custom shop template and I'm trying to achieve something like this. Where the user can choose the product variation in the dropdown, choose quantity, and click add to cart without ...
0 votes
0 answers
133 views

custom post type query causing errors

Any idea what is wrong with this? It "works" but it runs the error_log bananas. It should be noted that this code excerpt is from the "404.php" file Here's the code: ...
0 votes
1 answer
37 views

Dynamically switch file in get_template_directory_uri() | Function [closed]

I need to switch scheme color of my WordPress theme trough Redux option panel. My plan is switch the CSS file trough get_template_directory_uri() | Function. The scenario is: Create 2 scheme color: ...
0 votes
0 answers
50 views

Configuring Xdebug with docker compose

I'm trying to configure a WordPress development environment with docker-compose and Xdebug but I can't get the debugger to work with a simple break point on info.php file after starting my debugging ...
0 votes
1 answer
28 views

How to get a random single category name in get_posts()?

How can I get a random category name one at a time?? The post may have multiple category instead of a single category. I just want to show a single category name in the post grid loop. $...
user avatar
0 votes
0 answers
101 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->...
  • 13
0 votes
1 answer
25 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
90 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
23 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
51 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
77 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
36 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 ...
  • 818
0 votes
0 answers
23 views

How to add wysiwyg editor in customize screen using customize_register

Welcome I am developing a theme and I need to add wysiwyg editor to the customize screen using the “customize_register()” , I searched a lot here and on other sites about how to add it, and although ...
0 votes
0 answers
52 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
0 answers
14 views

Gallery functionality in custom theme

I'm new to creating my own theme and I barely scratched the surface of this topic so far. But my end goal would be to create a "gallery like" functionality. Maybe there are some functions or ...
  • 101
0 votes
1 answer
36 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 ...
  • 451
1 vote
0 answers
204 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, ...
  • 135
0 votes
0 answers
12 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(){ $...
  • 111
0 votes
0 answers
21 views

Need help for some PHP code

I've already set all the fields in my theme settings but I want that carousel-items class repeats whenever I add slides to it, and [0] changes to [1],[2],... <div class="carousel-items"&...
0 votes
0 answers
16 views

theme directory fallback image outputs url and not the image

I am adding a custom post thumbnail column to the user admin table in WordPress. I want to retrieve a fallback image from my theme image directory if no post thumbnail has been created. I don't want ...
  • 125
0 votes
0 answers
35 views

How to register dynamic settings in WordPress Customizer?

I have been experimenting with the Customizer JS API to create Panels, Sections, Settings and Controls in the Customizer. Till now, I have been using the PHP API but decided to try the JS API for the ...
1 vote
1 answer
59 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
0 answers
97 views

need to find duplicated meta value in custom filed and view the posts that have the same value

I used this code but return blank <?php global $post; global $wpdb; $duplicate_titles = $wpdb->get_results(" SELECT meta_value FROM $wpdb->postmeta INNER JOIN $wpdb->posts ...
0 votes
0 answers
23 views

How to add audio files to audio player in WordPress custom theme?

I want to add the native html5 audio player to the header of my custom WordPress theme but I want to be able to upload and change the audio files from wordpress admin. No idea which direction I should ...
  • 1
0 votes
0 answers
68 views

How do you get the current post taxonomy so I can get the current post taxonomy? into a variable to THEN loop through all post with that taxonomy.,

Is there a function that I could use to pull the current taxonomy (each post should ONLY have 1 taxonomy) from the current post so then I can store it in a variable to use it in a loop to loop through ...
0 votes
1 answer
31 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 ...
  • 177
0 votes
0 answers
1k 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 ...
  • 101
0 votes
1 answer
27 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
1 vote
0 answers
48 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
510 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
0 answers
15 views

Elementor Sidebar not loading when PRO elements plugin is active

I am currently running into an issue on my site whereby the elementor plugin will not load in the editor view while the PRO elements plugin is installed The issue is that the theme and pre-built site ...
  • 1
0 votes
0 answers
20 views

Is there a list of default generated Gutenberg block CSS? Unable to align video blocks

This is my first attempt at creating a theme for WordPress, I seem to have things working well for the classic editor, however, I'm having issues with the Gutenberg block editor. I'm trying to get it ...
0 votes
1 answer
34 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
34 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
193 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
0 answers
15 views

Let user to upload multiple time

I'm using the Superio WordPress theme and I want to add a feature to the theme but I don't know how! The default logic of the theme is like this: The user would log in to an account and would apply ...
0 votes
1 answer
49 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
55 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
27 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
109 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 ...
  • 51
0 votes
0 answers
633 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 ...
0 votes
0 answers
14 views

How to code a wordpress page properly? Dashboard or unique Theme files or alternative?

At the moment I want to do individual pages which will display results fetched from an api (each page has an individual api key) from an external site. Later I want to add a plugin where you can enter ...
4 votes
1 answer
267 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
141 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 ...
  • 15

1 2
3
4 5
89