Questions tagged [theme-development]
Themes create the public (front-end) interface for a WordPress site.
4,428
questions
0
votes
0
answers
16
views
Image and font support missing in editor when deploying theme remotely
So I am starting to learn Wordpress development and today I uploaded my first custom theme from my local environment to the remote hosting server. My theme installed with no issues and I was ready to ...
0
votes
2
answers
41
views
Why is my Toggle field not showing in Gutenberg?
I am adding a PluginSidebar to Gutenberg and it works until I try to add a meta field to the sidebar. Then it doesn't work. I'm not sure why though.
import { registerPlugin } from "@wordpress/...
0
votes
0
answers
17
views
Why isn't custom sidebar panel not showing up in the Gutenberg Editor?
I am trying to add a custom Gutenberg sidebar panel but it isn't showing up. I'm not sure why though as I have the sidebar.js and then enqueue it in PHP. I ran npm run start and it compiled the JSX ...
0
votes
1
answer
51
views
functions.php doesn't load all custom theme assets
I'm writing a simple wordpress theme. I've added this function inside the functions.php file and I've noticed that only style.css is loaded. Is there something wrong that will cause that the other ...
0
votes
1
answer
21
views
Wordpress search field won't get wider
I've tried everything I know how to get this input field to 100% but I can't seem to do it. It always stays at some stuck width. .search-field is the stock class and I've targeted that class using max-...
1
vote
1
answer
16
views
How to set the margin on an innerBlock in a block variation?
I am trying to define a block variation that has an innerblock with a margin. I was able to set the color of the innerBlock just fine, but for the life of me, I can't make the margin work.
Here's what ...
0
votes
0
answers
19
views
Add text when displying attribute with a hook on single product page
I have books as products in woocommerce and I'm trying to show the order of the book in the series. It should look something like this:
"The book 1 of Series"
I've managed to add the link to ...
0
votes
2
answers
46
views
Font Awesome Icons as squares [closed]
I have been trying to migrate my html css and javascript static website to a wordpress dynamic theme. Everything worked fine and looks perfect but for some reason my font awesome icons appear as ...
0
votes
1
answer
128
views
WordPress PHP8 Critical Error in class-wp-widget.php
Recently updated to PHP8 and I'm getting a critical error related to the theme.
The critical error is:
Fatal error: Uncaught ArgumentCountError: Too few arguments to function WP_Widget::__construct(), ...
0
votes
0
answers
15
views
When trying to run build script with gutenberg (with SVG import) - Error: Plugin name should be specified
I have a theme that is live and has some 10-20 custom gutenberg blocks,
Those blocks sometime have svg imported to them like so
import logo from './logo.svg'
Today when I was trying to work and ...
0
votes
0
answers
36
views
I am using update_option function to update theme options programatically but page needs to be refreshed many time for changes to reflect!
update_option( 'my-settings', $my_options, true );
This is updating the option but I need to refresh many times or clear cache every time for changes to reflect in frontend, is there a way for ...
1
vote
1
answer
31
views
Full site editing templates folder vs block-templates
I have a modified Bedrock installation that moves the theme folder outside of the wp-content folder (and the normal app folder for Bedrock). In this setup, the app folder has a data folder that is the ...
0
votes
0
answers
10
views
Getting error when accessing Customizer Page
i get this error when i try to access my multisite customizer page.I tried to see what it was, i thought it was a plugin conflict, but i think its something else, i guess
Fatal error: Uncaught ...
1
vote
1
answer
37
views
How to make content as required in custom post type?
I created custom post type Testimonials and made the title required using the code in this link:
Require title for pages
Now I applied the code in order to make the content required, and it works fine....
0
votes
0
answers
6
views
Fetch Custom Woocomerce filed data and check the data avialble in Wp-user table as nicname or username using function.php
I write a code for add custom filed in checkout form as add affiliate code I want to match that custom field data with username. If custom field data match with any of the username the chcekout ...
0
votes
1
answer
21
views
How can I use pre declared blocks in a php file?
Is there a way/ a function to insert a block and user reusable blocks from inside a php page/template-part like use_block('jetpack/google-calendar') to a block?
(I am using a partial block theme, ...
3
votes
1
answer
33
views
Execute javscript when theme customizer loads (autosave issue)
I have a theme that is having an issue when there are unsaved theme changes, then the user restores an autosave.
My theme has some jquery that watches for a font to be changed, then updates a second ...
4
votes
1
answer
59
views
Return the_content() with custom div class for a subset of posts
Is it possible to have the_content() function return the post content in a div with a custom CSS class (i.e. something other than the-content)?
I have a unique post I'm trying to lay out that requires ...
0
votes
0
answers
16
views
Wordpress administration is gone after creating base theme
I have following files for a base theme:
wp-content/themes/base/style.css (empty)
wp-content/themes/base/index.php
// index.php
<?php declare(strict_types=1);
echo wp_nav_menu();
After ...
2
votes
1
answer
23
views
WordPress Two Level Filters on Getting Custom Taxonomy Terms
I have a Custom Post Type Called movie and I have two taxonomies genre and quality associated with that.
Now I need to get/filter all terms IF
genre = 'action'
AND
quality = 'HD'
Using this code I ...
2
votes
2
answers
42
views
Theme's featured image option is not showing up
I'm new to WordPress development. I watched a video on how to add featured images. For some reason it's not working, and I can't really figure out why. The option for featured image is not showing at ...
0
votes
0
answers
19
views
WP Customizer get control value on change
I've written a function for my WP theme based off of this question:Changing the entire control choices using wp.customize with JavaScript
My code is as follows:
( function( wp, $ ) {
wp.customize....
4
votes
1
answer
61
views
Is there any filter or action hook to remove layout classes from appearing in my templates?
With the new WordPress 6.1 core update, my site is now having a is-layout-flow class added to the layout.
Normally this wouldn't be a huge issue. However, we are using the WP API to feed the content ...
0
votes
0
answers
15
views
How to create A - Z List with pictures?
I need to create an A to Z list with pictures of the players profile pictures
I know there is A to Z plugins, I did do some research and the A to Z list, created links.
I need something like this
I ...
1
vote
0
answers
51
views
WordPress Ajax load doesn't work
Hello I have set up custom Ajax load more without plugins, but it’s only showing 3 posts on home page, and when clicking on button to load more it’s not loading anything. As I am a beginner I am ...
4
votes
1
answer
40
views
Theme template file for a specific custom taxonomy
Is it possible to create a template file specific for a custom taxonomy?
For example, I have music Custom Post Type and it has three taxonomies artist, album, and genre. So the hierarchy would be like ...
0
votes
0
answers
20
views
How to make it so I can "use" template parts in (classic/full) site editor
I want to make a website with an editable front page for a client with no coding knowledge,
the client should be able to edit the front page in the site editor like a regular page, but should be able ...
0
votes
1
answer
28
views
How to automatically set a Template Page Name next to a page in menu screen such as WooCommerce pages, front page, or posts page in wordpress?
When creating a menu, and after selecting a page as front page and another page as posts page..it appears next to the page in menu screen. For example, "Front Page" appears next to home page,...
2
votes
1
answer
30
views
Can't select my block by clicking on it on apiVersion - but using blockProps
I'm building my first Wordpress block but I've ran into an issue. If I set my block's apiVersion to 2, I am not able to select my block.
I'm aware that for apiVersion 2, you need to use the ...
0
votes
1
answer
14
views
Not Able to Access Terms Under Custom Taxonomy Archive
Having a Custom Taxonomy called movie-genres
'rewrite' => array('slug' => 'movie-genres', 'with_front' => true) );
register_taxonomy( 'movie-genres', array( 'movies' ), $args );
And I have ...
0
votes
1
answer
16
views
orderby property of query on pre_get_posts returns incorrect value
I am attempting to implement some custom sorting logic for a column but are facing issues in the pre_get_posts hook. The value of the orderby property on the query is not returning the value ...
0
votes
1
answer
44
views
My theme is full of error messages in the "Customize" screen, but nowhere else
I'm making a custom Wordpress theme. At some point, the "Customize" page in the admin panel has completely broken, giving me tons of these errors:
Notice: Trying to get property '...
1
vote
1
answer
290
views
How do I work with responsive images in Wordpress? (img srcset/sizes)
I'm trying to make a Wordpress theme and I'm very confused about how I should use responsive images. Here's how I'm currently displaying each thumbnail in my post list:
<? the_post_thumbnail() ?>...
1
vote
1
answer
123
views
Webpack does not create or update index.asset.php file in build folder
I am using @wordpress/scripts package to set up Webpack in a WordPress theme. However, I ran into a problem with default Webpack configuration as it is creating an unnecessary .js file inside the ...
0
votes
1
answer
85
views
Custom Theme functions.php – Using add_settings_field and input type="file" to set custom logo
I've seen several examples for "add custom logo" to wordpress theme, most of which use this basic code, specifically
function display_logo_element()
{
?>
<input type="...
0
votes
0
answers
16
views
Is there any other ways to replicating changes on live from staging without pushing from git
I am just curious to know if is there any possible and reliable ways to replicate staging changes to the live site without using the git repo.
Please share if there are any best practices to do that.
0
votes
1
answer
57
views
How to show associated fields if checkbox is checked in customize widget screen using wp_customize?
I created a checkbox section to let user to choose whether wants to display a button in the menu or not, I set the default value to false, and created two fields for the label of the button and the ...
0
votes
1
answer
51
views
How to Enfroce Domain Licensing Limits? [closed]
I'm looking to sell premium WordPress plugins (using Easy Digital Downloads licensing manager) and I want to limit the number of domains the plugin can be activated on (to receive automatic updates). ...
0
votes
0
answers
30
views
Meta box not displaying on the plugin page
I am working on a plugin and I am creating a meta box on my page using the below code but it's not displaying anything.
Any idea where is the issue with my code?
class bt_dashboard
{
function ...
0
votes
0
answers
140
views
How to Enable Hot Module Replacement with Webpack
I am using @wordpress/scripts to set up WordPress with Webpack in a Wordpress theme. The current configuration works fine and compiles the scss and js files from the src folder when I run npm run ...
0
votes
0
answers
38
views
Add default block css when the block has been added with php?
I have made a shortcode that adds a default block (eg. Cover) using php so that it can contain dynamic content.
This works fine except that wordpress doesn't know to add the css for that block type.
...
0
votes
1
answer
38
views
Default Wordpress Query for a Specific Custom Post Type URL
I need a little more clarification on the default query for a specific custom post type url. I am learning how to use WP default functions and queries via Udemy. However, I feel like this little part ...
0
votes
0
answers
76
views
After a while attachment meta data is missing "sizes" data
We like to use custom image sizes for custom WP themes. This way, we can provide appropriate images for the custom elements and we can ensure that images don't load too large or too heavy. Now we've ...
0
votes
0
answers
25
views
add_meta_box showing blank screen in my page
I am working on the plugin and getting issues in add_meta_box.
// Page URL-
http://localhost:8080/wordpress/wp-admin/admin.php?page=testingpages&action=edit
//Plugin page code
if ($_GET['...
0
votes
1
answer
25
views
Override plugin constant using a theme
I have a plugin which starts:
<?php
define( 'MAX_THINGS', 30 );
I would like to change the constant to be 2.
I know I can edit the plugin file directly - but that will be overwritten if the plugin ...
0
votes
1
answer
89
views
Template for posts of category in block theme?
I am trying to use a custom template for posts of a given category in a block theme. I have created the template file in html (post-show.html). And I have edited the template in the site editor. As I ...
0
votes
0
answers
166
views
PHP warning: Undefined array key 2 in feed.php
I'm trying to resolve "PHP warning: Undefined array key 2 in ... feed.php". I was looking online, and it seems that when there is an undefined array, I can resolve the issue with an if(isset(...
0
votes
1
answer
51
views
Website Developer has gone missing! How to gain full access of your code from a Wordpress website?
I have hired a website developer to create a Wordpress website for me.
The website is nearly finished, but the website developer has gone missing!
I have admin access to the Wordpress dashboard.
How ...
0
votes
1
answer
58
views
How to fix wp-env: "error: Your local changes to the following files would be overwritten by checkout"
I have been using @wordpress/env for a few weeks, starting it with npm run wp-env start. Since this morning, that now fails with:
> wp-env "start"
✖ error: Your local changes to the ...
-1
votes
1
answer
33
views
Configuring static page with add_rewrite_rule gives 404 after navigating to Permalinks admin panel
I would like to create a simple static page in my theme which would then show some practical information on a certain event. The page would be served on the path /practical. For now, there are no ...