Questions tagged [theme-development]
Themes create the public (front-end) interface for a WordPress site.
4,505 questions
0
votes
0
answers
35
views
add_image_size() parameter four ($crop = true) is ignored: the_post_thumbnail() returns scaled image(s) instead of hard cropped
Good Day!
I am trying to achieve hard cropping of thumbnails in a custom WordPress theme. In functions.php I have added add_image_size('blog-large', 860, 484, true);. Thus, the fourth parameter ($crop=...
0
votes
1
answer
32
views
Bug in translation system: load_theme_textdomain() returns true, files are available and accessible but the language defaults to english
Looks like this has been introduced in WordPress 6.7 - I have the following code:
$loaded = load_theme_textdomain(MY_TEXTDOMAIN,get_stylesheet_directory() . '/languages'); // internationalization
$...
-1
votes
0
answers
17
views
How to make checkbox required
I am trying to make a checkbox required in order to proceed to the next page. I am develping inside of functions.php. Does functions.php not allow the required inside of regular HTML tags?
Here is ...
0
votes
0
answers
17
views
WordPress Block with Interactivity API e Preact Component
Good evening, everyone. I am developing some custom blocks with the new Interactivity API. Within some of the blocks I need to use some complex components that I decided to develop with Preact, so as ...
0
votes
0
answers
15
views
how to combine wordpress and front framework
I saw this website kzero and they make 3D websites with WordPress, using the WordPress API. Can anybody explain which framework they use and how?
0
votes
1
answer
15
views
How could I prevent using the same custom loop in a template file when I only need to change one meta_query parameter?
I am displaying a set of upcoming fixtures for two cricket teams on the same page. The fixtures are created from a CPT and the relevant team is selected from a custom field.
I have everything working ...
0
votes
1
answer
12
views
Starter Bootstrap and Custom Fonts
I'm building a custom theme using https://them.es/starter-bootstrap I have some custom fonts in the /assets folder and some Sass generated by http://font.download The custom fonts seem to be included ...
0
votes
1
answer
18
views
WordPress function::: get_header();
Can I use the following function twice?
<php get_header(); ?>
<php get_header(); ?>
<div class="news-heading">
<span>Trending</span>
</div&...
0
votes
0
answers
23
views
How can I keep a WordPress dropdown menu open when navigating to a child page?
I'm using WordPress with the Astra theme (free version), along with Elementor Header & Footer Builder (free version) and the WP Mobile Menu (free version). I've set up a dropdown menu, but it ...
0
votes
1
answer
18
views
Custom theme on multisite has issues with standard loop output
I am experiencing the following error output when using the standard loop on page.php and single.php on a multisite-based WordPress installation. The loops are the same for both template types, with ...
0
votes
2
answers
27
views
What is the best way to use Bootstrap for WordPress Theme Development?
I try to connect Bootstrap with WordPress Theme using this-
1st Method:
// Enqueue the latest version of Font Awesome
wp_enqueue_style('font-awesome', get_template_directory_uri() . '/assets/css/...
1
vote
0
answers
41
views
How to add custom attributes to wordpress block theme
I am creating a wordpress theme wth html and jquery. I want to add a data attribute to my pattern so that I can use jquery to control the behaviour. When I add a data attribute to my code, I get an ...
2
votes
1
answer
146
views
Date not working correctly
I have made a custom theme and used CPT UI to create Event Post Type and ACF to create Event Date Field. I am using following code to display Remaining Event Days in frontend:
$event_date = strtotime(...
1
vote
1
answer
36
views
i18n in Wordpress Theme
I'm trying to set up language translations based on the Wordpress language setting.
I feel like I've done all the steps outlined in https://developer.wordpress.org/themes/functionality/...
2
votes
2
answers
74
views
Disable interactivity for core navigation
I want to disable the default interactivity behavior from the core navigation block. I tried the following:
Load my block variation in the functions.php:
function da_custom_block_variations() {
...
0
votes
0
answers
57
views
Correct way of implementing complex navigation in Gutenberg
I am a bit lost in creating a block theme. I have read a lot about theme development and block development in the wordpress documentation and also at fullsiteediting and have some kind of ...
0
votes
0
answers
25
views
Event: when theme swapped
I want to do some clean-up when my theme is changed out: unregistering cron jobs and other theme-specific things.
I've been trying to look for an event that fires when my theme is being swapped out (...
2
votes
1
answer
56
views
Display Gutenberg blocks from "Posts Page" above the post list?
I have created a page that is set as my "Posts Page" in the "Reading" settings. On that page I have added a Gutenberg block but it doesn't show up on the page so long as I have the ...
1
vote
1
answer
71
views
Which is recommended to learn first: classic themes or block themes?
Which is recommended to learn first: classic themes or block themes? I'm a beginner who recently started learning WordPress theme development.
For someone who’s developing with WordPress for the first ...
0
votes
2
answers
89
views
Full Site Editing, Block Theme, Gutenberg, Site Editor
With all the different names and ways to edit a WordPress site I'm a bit lost as how to future proof my theme.
Let me explain a bit...
First off, I use WordPress professionally at my job, I use it as ...
0
votes
0
answers
18
views
Submenus with recursive submenus
I have been able to create a menu with submenus using wp_get_nav_menu_items, but I am unable to create submenus with submenus recursively
This is the code I used for my menu with submenus
I have this ...
0
votes
0
answers
12
views
Right to Left WordPress (Farsi) Changing the Order of Taxonomy to Term in URL
Using WordPress Farsi(Right to Left), I am seeing an issue in my URL which is instead of rendering the URL as Domain/Taxonomy/Term/ format
I am getting in reverse order as Domain/Term/Taxonomy/
...
1
vote
0
answers
45
views
Custom Logo: why parameters are not working at all?
I'm trying to use my custom logo, uploaded from Appearance > Header.
But none of the parameters I have set in my_custom_logo_setup are working.
In functions.php
//Add custom logo
function ...
0
votes
0
answers
26
views
Wordpress search every time shows no search found even data exists
I am using wordpress. What I am doing is, that when the user enters anything then it will search from the post and will show the result.
I have added static content $_REQUEST['keyword']="team&...
0
votes
0
answers
16
views
How can I able to exclude 'Category' and 'Tag' slug from the URL in Wordpress without reloading to new site?
in functions.php, I wrote this code:
function remove_category($link) {
if (!is_admin() && (is_category() || is_tag())) {
$category = get_queried_object();
$...
0
votes
0
answers
20
views
Frontend Enqueued Files in the Backend
I am currently developing a plugin and I need to get the handlers of various enqueued files in the theme. I have tried working with global $wp_scripts and global $wp_styles, but I only get the scripts ...
0
votes
0
answers
13
views
require used as a function to load theme dependencies?
I've inherited a site from another company recently and found this in their functions.php file:
function themeLoader()
{
locate_template(include('inc/wp_reset.php'), true, true);
locate_template(...
0
votes
0
answers
24
views
How to Add Dynamic Sliders to WordPress Customizer with JavaScript
I'm currently working on a WordPress theme where I need to add dynamic slider controls in the Customizer. My goal is to have three default slider controls and provide a button that allows adding new ...
0
votes
0
answers
41
views
wp_nav_menu_items callback not triggered
I display the menu so:
<?php wp_nav_menu(array('theme_location' => 'primary'));?>
I am trying to edit it, in my functions.php file I have:
add_filter('wp_nav_menu_items', '...
0
votes
0
answers
34
views
How to get ACF field to show up on all posts on front end?
I have thousands of posts with attached files. These attached files are part of Advanced Custom Fields Pro. However, they are not showing on the front end for the posts.
These files are utilizing the ...
0
votes
2
answers
131
views
FSE Change Post Template to Something Other Than a List
I'm currently building a hybrid theme and am having trouble with my post template. It keeps rendering as an unordered list when what I want is a div structure. Is there any way to change it so that ...
2
votes
0
answers
80
views
How to Use Webpack with WordPress Script Modules and Enqueue a Custom Class
I am working on a WordPress project using version 6.5, which introduced support for JavaScript modules. I have a parent theme that exports a JavaScript class, and I want to import this class in a ...
1
vote
1
answer
69
views
How to add translation for FSE theme?
How to fulfill this requirement for FSE theme "All theme text strings are to be translatable." ?
I am using esc_html_x() to translate string in my patterns
Example
<?php esc_html_x('...
0
votes
0
answers
11
views
Capture the Selected Radio Button Value between two files in wordpress theme
$html_output .= '<div class="form-group">
<label><input type="radio" name="driver_type" value="society" checked required> ...
1
vote
1
answer
30
views
What is considered good practice for registering menu locations?
I decided to try my hand at creating my own WP theme from scratch. I've made a header, a navbar, and a footer so far. I've also registered a couple menus, so my navbar will be populated automatically ...
0
votes
0
answers
23
views
Smooth Scrolling Animation of Image Between Two Containers (Elementor) Using JavaScript and GSAP
I am trying to achieve a smooth scrolling animation in Elementor where a Cola can image moves from one container to another container as the user scrolls down or up the page.
please see attached.
I am ...
0
votes
1
answer
55
views
How to create new title and its description inside a section in WP Customizer?
Actually, I want to add a new title General settings with a small text description of it in a new section that I've created in the WordPress Customizer.
The section is already created and works well, ...
0
votes
1
answer
69
views
Activate Gutenberg group block for theme
I using the Timber Starter Theme for my website and would like to group multiple blocks through the Gutenberg block editor. Unfortunately, the group option isn't available. I'm wondering what needs to ...
0
votes
0
answers
18
views
Composer dependency
Hello there I'm working on Wordpress plugin.
How do i prevent version conflicts with other plugins or themes.
Please is there any working code ?
Help me please
0
votes
0
answers
56
views
How to add multiple custom blocks in custom Wordpress theme using create-block?
I want to add multiple custom blocks to my custom wordpress theme using create-block package.
In my root folder I initiated package.json by running npm init -y and added wp-scripts as a dev dependency....
0
votes
0
answers
47
views
I want to move the one click accesbility button on bottom of my website screen,
I want to move the one-click accessibility button on bottom of my website screen,Kindly give me a code for that
0
votes
0
answers
33
views
Adding features to Gutenberg without theme.json
I am using a non-block theme for my website and am using Gutenberg for writing posts. I want to extend Gutenberg's functionality by adding the image lightbox feature. So I added a theme.json file to ...
0
votes
0
answers
21
views
Customizing Playground for self-hosting with a private theme
I'm trying to create a customized WordPress playground for a private theme that I can host in Github Pages. Following the docs I've been able to reliable set up a self-hosted Playground but I'm unable ...
0
votes
0
answers
55
views
How to enable wc_add_to_cart_message?
I faced a problem and I have no idea how to fix that. I enabled "Ajax add to cart", and now wc_add_to_cart_message now shows the message that says "X added to your basket." I ...
0
votes
1
answer
62
views
Export Wordpress theme with modifications for other site
I purchased wordpress theme.
No i have upoloaded it on new site and modified it as i wanted.
Now i want to use that theme in my all sites.
Problme is theme also saves its oevrride stuff or ...
0
votes
2
answers
98
views
How to use meta_query to retrieve posts from multiple custom post type
I am having two custom post type "meet_our_community" and "news"
I have added a checkbox field named 'add_to_meet_our_community' from the acf to 'news' post type.
Now I when tried ...
0
votes
2
answers
20
views
How to build help pages similar to Wordpress Developer Resources
We need to build a help page similar to Wordpress Developer Resources (see the screenshot below). We're problably looking for a developer solution as we haven't found any plugin that would fit our ...
0
votes
0
answers
59
views
WP Update Messages get cut off during Theme update
I created a custom class for updating my custom theme. It has been working well for several months but the usual WordPress messages during upgrade get cut off when any upgrade process is running.
The ...
0
votes
0
answers
48
views
WordPress theme.json: Why doesn't "contentSize" work
On the WordPress 6.5.2 version, in the theme.json file, I have the following code
{
"version": 2,
"settings": {
"layout": {
"contentSize": "...
3
votes
0
answers
74
views
Registering a block in "My Patterns"
I have created a bunch of blocks, and every time I have saved it as a pattern by selecting the block in the list view > three dots > Create pattern. All these patterns appeared in a new category ...