Questions tagged [javascript]
A client side scripting language useful for making interactive web sites. Questions about using JavaScript outside a WordPress context are off-topic but might be asked on Stack Overflow.
2,691
questions
0
votes
1
answer
14
views
Pass WP data to javascript
I'm using data attributes to pass product price calculation formula to javascript. Is it possible to pass it to javascript without being displayed in page source code?
0
votes
0
answers
11
views
WooCommerce custom SVG coloring tool [closed]
I need help regarding a WooCommerce store I'm building. It's for a custom textile designer, the idea is that customers can view a product's empty pattern, color it according to their taste and submit ...
0
votes
1
answer
53
views
Simple ajax request with Vanilla JS keeps given 400 Bad Request
I am new to Ajax and hope someone can help me with the following.
I am trying to make simple ajax test in wordpress, but getting al the time a 400 Bad request. I am really wondering why this is not ...
2
votes
2
answers
113
views
How to render HTML content using the Interactivity API?
I'm testing the new Interactivity API and want build a block that renders the title and content of a random post.
This is the content of the render.php file:
<?php
$block_attributes = ...
0
votes
1
answer
19
views
How to get selected category objects in the block editor?
I am using the following functions to get the selected category objects. It seems to always return no matches even though there are several. What am I missing here?
(function (wp) {
const { ...
0
votes
0
answers
27
views
Custom PHP contact form issue
I'm building a WP website with a custom contact form in PHP, HTML and Javascript.
The issue is when the user click the submit button to send the form, it redirects to a 404 page.
The PHP function:
...
0
votes
1
answer
68
views
Add Imports to Existing WordPress Import Map
How can imports be added to the existing WordPress import map?
Preparing the Module
I have a JavaScript module threeDTest.js which is enqueued using a PHP short-code (set to run everywhere):
...
0
votes
2
answers
49
views
How to auto rename JS files to prevent browser cache issues
Im creating a block plugin in worpress and each time I update my JS files, changes do not reflect to frontend because there's a browser cache.
I found some strategies in others frameworks that rename ...
0
votes
0
answers
23
views
Why does website not scroll to top of container when phone is rotated?
I'm using Elementor. I have a container that has a price list in it which looks terrible on mobile portrait. I used the responsive setting to hide that container on mobile portrait. Then I added a ...
0
votes
1
answer
23
views
Function to filter numbers from string
I'm looking to filter numbers from a string, and make them bigger in one case, and hide them in the other. The best way, as I understood, would be to use a custom function via functions.php and ...
0
votes
0
answers
12
views
How to display all submenu items as a breadcrumb
I'm trying to display all submenus of the active page as a breadcrumb navigation on a section of the page. How could I go about this?
For example;
Home
Program
P1
P2
P3
About
When I navigate to the ...
0
votes
2
answers
79
views
Elementor Form : client side javascript validation
I already did server side data validation using the hook 'elementor_pro/forms/validation' and it's working fine.
Now in addition, I would like to do client side data validation before submitting the ...
0
votes
1
answer
27
views
How to use useSelect to retrieve the currently default fontFamily?
I'm trying to identify where I could find this information but I've not been able til the present moment, to achieve it.
I've been looking in core/block-editor and core/editor. I've been researching ...
2
votes
0
answers
70
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
0
answers
55
views
Extend WordPress Gutenberg core/navigation-link
Hey folks So Im pretty new to this react + php in wordpress and I found one article where it showed how to extend a core block, which works fine for group and some basic block but When i tried to ...