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.

Filter by
Sorted by
Tagged with
0
votes
0answers
13 views

Javascript File Does Not Work

I created a page independent from the theme and added the php and js files of the pageto the theme folder, the php file works but the js file does not. Why could it be? PHP File: <?php if (!...
0
votes
0answers
15 views

Get Woocommerce Variation Price

I need to show the prices in installments, but when I select more variations they will appear in sequence. I need one to appear for each selection. How do I solve this problem? this is the code: ...
0
votes
1answer
17 views

Stop a script on a single page

I have a plugin that is no longer being supported, and it has an issue with moving a block to the end of a page. Globally this works fine, but on specific pages, I want to disable this script d=froi ...
0
votes
0answers
18 views

wp_set_object_term via js btn frontend

Hi I just copied some code to change a post custom field term by clicking on the btn with #projects-pay-btn id and work with it on frontend as end user, but it does not working. when the user push the ...
0
votes
0answers
8 views

Show menu point only if there are published posts

In my Wordpress website I have a menu point called "Jobs". This is linked to a page that contains mostly posts of a specific category (Jobs). I would like this navigation point to be visible ...
0
votes
1answer
18 views

@wordpress/components Button variants not styled

Whenever I import the Button component... import { Button } from "@wordpress/components"; ...and then use it with a variant: if (attributes.imageId) { return ( <Button variant=&...
0
votes
0answers
28 views

Refresh Gutenberg with JS for it show updated post

I updated the post content after the saving. Let's say I am replace apple to banana. function apple_to_banana($content){ $content = str_replace('apple', 'banana', $content); return $content; } ...
0
votes
0answers
16 views

How to change multiple same name input element in Wordpress post with jQuery? [closed]

I can change Wordpress input element with different name. As for example the following input element: <input class="wpProQuiz_button" type="button" value="Start Quiz" ...
0
votes
0answers
34 views

A letter 't' has appeared in the Accordion [closed]

I have built a site https://dev.portland.ac.uk/faqs/ (in development) using Flatsome theme and on the FAQs page I have used an Accordion. The letter 't' has appeared next to the downward toggle arrow ...
0
votes
0answers
9 views

JSPDF custom font not working in autoTable [closed]

I'm using jspdf autoTable plugin to generate table in my pdf. I'm using google encode sans font. It is working fine on the normal text in the pdf but not in the autoTable. Here's my code: doc....
0
votes
1answer
26 views

How do I access the contents of Wordpress Classic editor in admin area with JavaScript?

I am working on a small Wordpress plugin which uses JavaScript to add html tags with a css class to the visual text view in the Wordpress editor. I use the Classic Editor. According to Chrome ...
0
votes
0answers
11 views

login form should redirect to register page for in 1st login next time it should redirected to home page

I'm new to WP I need your help in redirect the user only for 1st time logging, in my landing page, 1 created a login form if the user logged for 1st time means it should redirect to register page and ...
0
votes
0answers
21 views

Query String Filtering API

Currently, I'm working on a search application that searches/filters stores(Custom Post Type) based on the store-feature(Custom Taxamonies) IDs. When I use the WordPress Fetch API, I can get the full ...
0
votes
1answer
24 views

Settings API form - submit with AJAX

I'm creating a plugin where I have a dashboard that is done with Settings API. I'm trying to save data from that form via AJAX. Form: public function agy_dashboard_page() { ?> <form id=&...
0
votes
0answers
36 views

Uncaught SyntaxError: Cannot use import statement outside a module [closed]

I making a dynamic custom slideshow block and in my PHP I am executing a callback which generates the HTML on the frontend of the site like so: function slideshow_callback( $block_attributes, $content ...
0
votes
1answer
45 views

Uncaught TypeError: jQuery(...).slider is not a function

i am trying to use the jQuery-ui function: slider(): here's my code that i wrote inside the jQuery(document).ready...: jQuery("#slider-wp").slider() and in my functions.php file i wrote ...
0
votes
0answers
17 views

How to one click view all comments on post (WordPress Admin)?

What needs to be changed so that comments are loaded not in 10 pieces, but all comments once. If there are a lot of them, then many times necessary to push link to "show more comments". Code ...
0
votes
2answers
29 views

Getting incorrect filepath inside custom block front-end output using @wordpress/create-block tutorial

I am following the official WordPress "Create a Block Tutorial" located here: https://developer.wordpress.org/block-editor/handbook/tutorials/create-block/ I used this as a starting point ...
0
votes
1answer
21 views

How to extend SelectControl with data from my theme

I'm building a custom gutenberg block that should have a dropdown (SelectControl) to select which css class should be added to my block. So far, nothing special. My problem is that depending on the ...
0
votes
0answers
16 views

Woocommerce Checkout Page Total Price Inside Google Pay Script

I have the following Google Pay script below and I am trying to replace the 1.00 for totalPrice with the total price (number) on the checkout page of my standard Woocommerce/Wordpress website: <...
0
votes
0answers
16 views

JS inside modal doesn't work

I'm using some modals (pop-up) with Elementor Pro on every page of my website for displaying forms, inside these forms are sometimes google maps field or datepickers and there are not initialized when ...
0
votes
0answers
12 views

Get Required Assets (JS, CSS etc) for post using REST API

I'm using the REST API to access WordPress data and publish it on a custom frontend as part of an integration. This works great because the shortcodes are parsed and rendered by WordPress so the ...
0
votes
1answer
26 views

Dequeue / Deregister script and replace it with a new plugin

I think I've read a dozen posts about dequeuing and deregistering scripts, but I haven't been able to make it work properly in my situation. My situation: The "uListing" plugins are part of ...
0
votes
1answer
19 views

Woocommerce disable order item link (backend) [closed]

I'm facing a problem where I couldn't disable the order item link for the backend (user role: shop manager). I've found some solutions but only tackle to the front end (customer-order page). However, ...
0
votes
1answer
40 views

How to test nonce with AJAX - Plugin development

I built a plugin, but now on end, I am not sure whether my nonce integrated correctly, and I'm not sure how to test them. Can anyone help me test it or let me know if the nonce is integrated correctly?...
0
votes
1answer
16 views

How to Get Post Meta in .Js File [duplicate]

i have post meta named 'product_price'. If this post meta is called in php it can be written: <?php echo get_post_meta($post->ID, 'product_price', true); ?> How to get this post meta '...
0
votes
0answers
29 views

Code is not executing, instead is showing on website [closed]

My client provided me with code from Authorize.net to place a seal on their website showing they are verified. When I add this code, instead of executing, it just displays the code on the website. I'...
0
votes
0answers
20 views

How to download data for each form separately with javascript and store each of it [closed]

I have many forms on the site (for each post separately). Now I would like to get the data from each form separately and get it for each one. So if I click a button in forms A, B, C, I would like to ...
0
votes
0answers
57 views

Post form - AJAX won't upload featured image - Plugin development

I have a form for adding a post via AJAX and PHP. I have three fields. Text, textarea and file input field. Everything it's working, but it won't upload a featured image. When I remove the AJAX call, ...
0
votes
1answer
19 views

Do I just put the html in a page when enqueueng or do I also have to reference js file from the html page [closed]

I am trying to get my javascript to work in my page, but I have always just put the html on the actual page, but now am wondering if I am supposed to put the <script src before the html as well to ...
0
votes
0answers
29 views

javascript onClick update user_meta from jquery.ajax

The idea is to add two values and the total of the sum save it or update it in user_meta with jquery.ajax. This is the code, but it gives me an error in the console Uncaught ReferenceError: 'total' is ...
0
votes
0answers
20 views

Integrate admin plugin into template. Very interesant (live search + autocomplete with wp rest api, in vanilla js)

I need a live search with wp rest api with autocomplete, in vanilla js. I found this plugin makes exacly what I needed. (I dont need this code as a plugin, its not a problem, but if it helps to make ...
0
votes
1answer
67 views

Where exactly do I write define( 'WP_DEBUG', true ) in wp-config file

would anybody know where I would write WP_DEBUG in wp_config file. I don't see it there. I would like to check why my javascript is not working. I have enqueued everything with php in the functions....
0
votes
0answers
23 views

Cannot find the php_ini configuration file to find my error log to see why my code is not working

would anybody know where I could find the php_ini configuration file to look for error log, as my code will not work in wordpress. I went to app folder, then public folder, but only see wp_config.php ...
0
votes
0answers
12 views

Search bar for wp menu

i have a search bar in my wordpress menu, which i created myself, this search bar shows results that come only from the database along with some checkbox, and i have an add to menu button as shown in ...
0
votes
1answer
54 views

My code will not execute in wordpress, even though I've been told the code is fine

I am battling with a problem for months now, that my code will not execute or show the result, when I enqueue it. I have been told, that my code is fine, and that it should work. The clock is showing, ...
0
votes
1answer
23 views

Noscript not working as it should in wordpress site

This is what I've done in my custom functions mu-plugin: function jsdisabled() { print '<noscript> <div style="margin:auto; display:table; text-align:center"> <div style=&...
0
votes
1answer
45 views

Adding HTML Code to Replace Text in PHP

I want to change my download button for non logged in users. Instead of the download button I want to show a custom HTML code with message to login/register. The below code is hiding the button but ...
0
votes
0answers
8 views

Drag-to-Scroll Landingpage

I am looking for a way to create a more playful landing page on my website. The best way to describe this is through the following example. https://dvein.com/ Basically, I would like to recreate this ...
1
vote
0answers
14 views

Can I change an external script's HTML?

I am using this worldnomads partner quote form in some posts with a script tag, however this external form uses an H1 title which messes up my heading hierarchy. I was wondering if it is possible to ...
1
vote
0answers
21 views

How to prevent UNDO on guternberg block editor

I have one flag in my plugin, and when it active i want to disable UNDO function in post gutenberg editor. Can someone help me to achieve this ? Thank you.
0
votes
0answers
22 views

Trigger function on Remove block or add new block in Gutenberg JavaScript

I want to perform certain action, when gutenberg block is removed or new gutenberg block is added in post editor. How do i add lister to this two event in gutenberg javascript ? Thank you
0
votes
0answers
15 views

Show next image in array if page is revisited by same logged user

I have a wordpress website, I want users when visiting a particular page to see an image, but if they go to another page and visit the previous page again, the image should have changed. The image ...
0
votes
0answers
15 views

Event listener callback returns undefined element

i am making a mobile menu for wordpress theme and have a issue where the element I am selecting returns undefined when the click event listener callback is called. But in constructor you can see that ...
0
votes
1answer
49 views

wp-api Backbone JS Client fetch options

I’m making a webapp based on wordpress in which I’m using the REST API for my users to get and create posts. I found the very useful REST API backbone javascript client which seems great. However the ...
0
votes
1answer
44 views

Wordpress update_user_meta onclick button with Ajax

I have a button that is limited to 7 clicks, when clicking number 5 is disabled, My problem if the user login from different device, the count start againg in 0 same as refresh page. my needs is, Save ...
0
votes
1answer
21 views

How to display different content on the same page using different URLS

I using wordpress. I have query string functionally that displays the content in the correct language. Example urls example.com/privacy/?lang=en example.com/privacy/?lang=es example.com/privacy/?lang=...
0
votes
0answers
30 views

Easiest way to find JS conflicts

What is the best / easiest way to find JS conflicts? I have a subpage where I load jQuery OwlCarousel which works fine, but sometimes does not set the active item correctly. So I suppose there is a ...
2
votes
0answers
19 views

Passing RichText attributes to function onChange

I have four RichText elements in a custom Gutenberg block I am developing, and they are all very similar except for the "name" attribute, which is currently hard-coded. What I need to do is ...
0
votes
1answer
16 views

Why does a <button> on Comment edit page submit the page?

I followed this guide to add a "copy to clipboard" button on the edit Comment page (comment.php?action=editcomment) It works but it also submits the page (i.e. the page reloads back to the ...

1
2 3 4 5
49