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

WP Still Generating 150x150 Thumbnail Size Even After Un-Setting Small Size in Functions.php

I am using following code to prevent WordPress from creating some un required image sizes for my theme and only upload the original size add_filter( 'intermediate_image_sizes_advanced', '...
  • 201
0 votes
0 answers
14 views

how to add a badge on product based on filter?

i want to make a compatibility badge based on the user filter, basically its an autoparts wordpress shop and i need the user to choose their car first and then save it for future (it's like a filter ...
0 votes
0 answers
17 views

WooCommerce shared categories

I am working on a WooCommerce site where different electronics products are sold. A Product can be either a used or a new product. There are different categories e.g. Refrigerator, Freezer, Microwave ...
0 votes
0 answers
32 views

Why does website stretch and white space on load? [duplicate]

On loading my friends website is stretching and has a white space. Does anyone know what is causing the white space and stretch on load ? https://bit.ly/treesurgeons
0 votes
0 answers
16 views

How to change a local wordpress installation xml export file urls? and change them to what if you don't have a live website?

This is my first time developing a Wordpress theme and i have created some demo content on a local installation. I need to make a xml file available for theme users to import it to their new ...
  • 1
0 votes
2 answers
210 views

ACF get_sub_field ALT TAG in the repeater doesn't show

I have one problem. I can't get the alt tag inside me repeater fields in ACF, I've tried multiple methods and nothing works for me, could you please help me? I can't fix this problem for a week :( ...
0 votes
0 answers
51 views

Pagination don't work with active filters

I'm make a custom theme para Wordpress and all works fine except the pagination when the filters are active. The console return 400 error and the navigation show /wp-admin/admin-ajax.php?paged=2 The ...
1 vote
1 answer
95 views

What is the purpose of a companion plugin

I have run into several themes, that clients have chosen, that have "companion plugins." These plugins have to be installed as a separate step after the theme is installed. What is the ...
0 votes
1 answer
33 views

Localize script not working in ajax

I'm getting the error "Uncaught ReferenceError: WPURLS is not defined" when I try to use ajax. Have I done something wrong here? Running the localize script after the script.min.js file, is ...
0 votes
0 answers
123 views

WordPress redirects page query parameter in URL

I am trying to create pagination in my theme. Everything is ok except when I click on pagination buttons for example [example.com/blog/?page=2] it will redirect to example.com/blog, but it's ok for ...
0 votes
0 answers
55 views

Remove Custom Post Category In Wordpress Slug Using .Htaccess

I am battling for days now to remove a custom post slug from Wordpress permalink. My theme Category permalink looks like this: example.com/listing-category/category I want to get rid of the custom ...
2 votes
1 answer
1k views

Full documentation about $args for register_rest_route?

I'm currently setting up a WP REST API, and the tool is really impressive and the amount of possibilities vast. I would however really love it to have a full documentation listing all of the possible ...
  • 421
2 votes
3 answers
654 views

Validate and Sanitize WP REST API Request using WP JSON Schema?

I'm currently setting up my first WP REST API and am attempting to understand how WP implements JSON Schema for the API endpoints, and the docs are imho really poor and confusing; so I wanted to make ...
  • 421
1 vote
0 answers
39 views

Gutenberg theme development: how to add "headers" option under styles > colors > elements?

I'm not sure if this is even possible as I'm still learning about Gutenberg full site editing theme development. I've done my best to research this and read over the documentation before asking this ...
0 votes
1 answer
21 views

Seperate plugin and theme files

I am in desperate need of help, regarding the following issue: I need to establish an API Connection to Salesforce, so that a user can search and retrieve certain data out of Salesforce. I thought, ...
0 votes
0 answers
10 views

Xamp installed local wordpress not allowing to publish or install plugin

I installed wordpress locally with xamp on my pc (Macbook pro Apple silicon 2021), yesterday I could normaly install a plugin (starter template) but today if I try to install a plugin it says at first ...
  • 101
0 votes
1 answer
17 views

How to Enable Ascending or Descending In WordPress Default Built-in Loop

Can someone please let me know how we can add Order functionality to WordPress Built-in Loop? <?php if (have_posts()) { while (have_posts()) { the_post(); // Post Content ...
  • 201
0 votes
1 answer
52 views

Wordpress get_media_embedded

test text <div class="video"> <?php $media = get_media_embedded_in_content( apply_filters( 'the_content', get_the_content() )); print_r($media); ...
  • 1
0 votes
1 answer
50 views

Can I make a Customizer dropdown-pages list include private pages?

I'm using the following code to add a field to the Customizer where the user can select a page from the available pages on the site: $wp_customize->add_control( 'resources_page', array( 'type' =...
2 votes
0 answers
50 views

Hide categories that are not used in the post type

I have a situation where I need to display categories on the Archive Page of CPTs, but if the category is not used anywhere in the CPT, it needs to be excluded from the list. For example, I have a CPT ...
2 votes
1 answer
85 views

What VSCode extensions are there for working with block themes? [closed]

I recently took another dive into Wordpress block themes by looking at the TwentyTwentyTwo theme. I'm noticing that all templating seems to take place either in PHP strings or HTML files chalked full ...
  • 51
1 vote
2 answers
2k views

Wordpress 6.x / PHP 8.x deprecated warnings in development environment

The problem: I want to run Wordpress 6.x with PHP 8.x in development mode - meaning define('WP_DEBUG', true); but Wordpress 6.x partial support for PHP 8.x throws a lot of deprecated warnings which do ...
  • 1,055
1 vote
1 answer
60 views

What is the "correct" way to add hooks or similar PHP behavior to a blocktheme?

I'm building a new site and I wanted to build my theme from scratch. However, the WordPress ecosystem is moving more towards blocks and blockthemes. As far as I can tell, it is possible to put hooks (...
1 vote
1 answer
88 views

Alias to theme folder for local development

I am locally developing a parent theme and child themes simultaneously (perhaps not best practice, but...). It looks something like this: parent.local /wp-content/themes/parent-theme/ child1.local ...
0 votes
1 answer
19 views

How to get authors who have added the post in the specific custom post type

I have a custom post called event and I have to show all the authors who have added the post. I have tried the below code but I am getting all the users on the page. For example. There are 4 users ...
0 votes
1 answer
38 views

For some time, some of my pages do not display the content anymore. Any idea where this could be coming from?

I recently worked on this website : https://semaine.com/ But since some time the content of the pages https://semaine.com/classroom/ and https://semaine.com/cinema/ are not displayed anymore. The ...
  • 1
0 votes
1 answer
28 views

How to allow certain PHP functions when using sanitize_callback in the word press customizer

Hi I am making my own theme in WordPress and setting up some customizer options and I have one for the text in my footer but I would like to still use <? echo date('Y');?> in the footer to ...
0 votes
1 answer
74 views

registering a global template wordpress 6.0

<?php /* * Template Name : Amaizing Inner Page 1 Template from me* * @package WordPress * @subpackage CADENTIC® BUSINESS THEME * @since MY BUSINESS THEME 0.0.1 */...
0 votes
0 answers
41 views

Getting text from custom field from customizer

So I've created a panel in the customizer section in WordPress to add the phone number to the site. It works fine in the back end but it wont show up in the front end here is my functions.php ...
  • 5
0 votes
0 answers
27 views

enqueuing external and internal js and css in wordpress did not work with owl.js animate.css

<?php function cadentic_files () { wp_enqueue_script('cadentic_owl_carousel',get_theme_file_uri('js/owl.carousel.min.js'), array('jquery'), time(), true ); wp_enqueue_script('...
0 votes
1 answer
95 views

I don't think WordPress is loading jquery or bootstrap js

I'm building a WordPress theme and I've used the code from https://codeinhouse.com/how-to-create-custom-post-type-slider-in-wordpress-without-plugin/ to build my slider I've also used https://github....
  • 5
0 votes
1 answer
54 views

WordPress navigation wont appear with wp_head

so im building a custom theme and ive got stuck on the navigation if i use wp_head(); it loads bootstrap and my custom style sheet but not the navigation if i use get_header(); it loads the navigation ...
  • 5
0 votes
0 answers
136 views

get_the_terms() returning wrong results inside of loop

When I use get_the_terms() inside a loop, the whole thing behaves very strangely. Sometimes the terms are included twice or three times and sometimes a post inside of the loop returns only false. I ...
  • 41
0 votes
0 answers
82 views

How do you remove header sitewide from mobile only?

I'm having trouble hiding my header on mobile devices. My wordpress theme does not have an option to hide it, so I was looking at the theme's header.php file if there was anything I could add to it. ...
0 votes
0 answers
123 views

WordPress custom menu can't show 3. level submenu

I Use a custom walker from my menu in WordPress and my menu doesn't show all levels. https://soulofcroatia.com/ ->One Day menu item. This is my code in header.php <?php ...
0 votes
1 answer
60 views

How do I get the trackback count of a post in wordpress without writing an SQL query?

How do I get the trackback count of a post in wordpress without writing an SQL query? I tried searching Brave Search and I couldn't find anything helpful. To fetch the amount of comments a post has, ...
  • 101
0 votes
1 answer
29 views

Post and page content not displaying in search results

I am using a content-search.php template part to output my search results. The post/page titles and links to those posts/pages are working correctly, but for some reason the the_content() function is ...
0 votes
1 answer
342 views

Adding google fonts to WordPress theme

I am trying to add google fonts to a custom WordPress theme. Therefore I tried to enqueue selected three font faces at once to make it fast loading. So, I use the below codes to register and enqueue ...
0 votes
1 answer
219 views

PHP File_exist() not working - Checking if File Exist in WordPress Theme Directory

I am trying to check if a certain archive file template exists in the WP theme directory. This is my code, I am not sure what I am missing here. <?php $file_name = '/archive.php'; $...
  • 302
0 votes
1 answer
369 views

How to enqueue a script which is type module without using script_loader_tag filter?

I'm creating a theme and i want to upload it to envato. I have a javascript file that is type module and i can enqueue it and then use script_loader_tag filter to add type module to it by these lines. ...
  • 1
0 votes
1 answer
301 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
60 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
47 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
39 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
31 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
206 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
63 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
56 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
31 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
137 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

1 2
3
4 5
89