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
1answer
10 views

How can i stop woocommerce checkout event based on api request result?

I'm building a custom woocommerce payment gateway and the following code is running on the woocommerce checkout page, and I'm trying to prevent the user from submitting the order till he writes his ...
5
votes
2answers
2k views

How to refresh Theme Customizer after change color inside wpColorPicker?

I develop my custom widget with setting where I can set up custom color for the widget. I use this code to initialize wpColorPicker instead of default text input in form() method of Widget class: ...
0
votes
1answer
2k views

How do I add JS and CSS to WP (Flatsome)

I have a codepen that I would like to import into my WP setup. It is an expanding column layout, which includes custom CSS and JS. Link here: https://codepen.io/thedonquixotic/pen/WGYXyd Now, I have ...
0
votes
1answer
506 views

Populate an array from the loop, and then read the array into JS

On my site I've got a custom post type. Each custom post has a thumbnail of a person, and an extra custom field that has another image in it. I've written code so that when the user hovers over the ...
0
votes
0answers
6 views

Can I insert ACF repeater fields into MaxMegaMenu via JS?

I have to add a Slick slider with ACF repeating fields to MaxMegaMenu, unfortunately I don't know how to add such a large piece of code via Javascript (passing js Var?). Has anyone tried to add ACF ...
0
votes
1answer
7k views

Ajax page load without reload

I am working on a script to load my page without refreshing. It is working as I want it except for one thing. The test site I have up is http://dev.dog-company.com . Only home About us and FAQ will ...
1
vote
1answer
496 views

Integrating PHP into Javascript to display map markers with Google API - problem with wp_localize

I would display Google maps markers on custom site temple with Google API maps. I do everything like this post: Integrating PHP into Javascript to display map markers with Google API But a console ...
0
votes
1answer
704 views

Relative path instead of absolute for wp_enqueue_script

When you enqueue scripts or styles with the following: function themeslug_enqueue_style() { wp_enqueue_style( 'core', '/style.css', false ); } add_action( 'wp_enqueue_scripts', '...
0
votes
0answers
23 views

jQuery being deferred in Safari & Firefox? [closed]

I'm building a WordPress site with Elementor and I've come across a strange issue where scripts are being deferred in Safari and Firefox, but not in Chrome. This is causing inline jQuery to fail with ...
1
vote
1answer
1k views

Passing select control value to block

I have created a gutenberg block and a select control that has some class names. The select control is in its own panel in the sidebar. My issue is when I try to call the select controls value/size. ...
0
votes
0answers
15 views

“jQuery Not Defined” Error When Connecting to PayPal

I have been looking all over Google for hours now and am very confused. Everyone has a different answer, and most don't explain where to put the code snippet that they post. I am attempting to create ...
0
votes
1answer
10 views

Ajax sometimes work and sometimes just don't work

So ive create load more posts using ajax following tutorial i found online. At first it works when there's just one button and so i create another one, and it works at first try but when i try again ...
0
votes
1answer
643 views

Js errors in wp-admin

I have a lot of js errors in wp-admin and, for example, I can't see visual composer in post or pages, I can't add a box to a widget, etc. I got that errors in all wp-admin pages. I updated wp and all ...
0
votes
1answer
11 views

Override user-edit.php to design own profile page

I have searched everywhere but can't find any relevant information on this. I want to rearrange fields on the User profile page (wp-admin/profile.php). Can anyone please let me know how can I make ...
0
votes
0answers
17 views

MediaElement.js Changing the audio volume orientation for some players

I'm currently trying to change the orientation for some audio players, not the default settings. Unfortunately the code below is not making the changes I need. When I console log the options, I can ...
0
votes
0answers
6 views

Google Analytics Opt-Out Function Using wp_head + Remove Link When Clicked

The aim / goal here is to be allow the visitor to turn ON Google Analytics as opposed to turning it OFF. In other words; it should be OFF by default with the option to turn it on. If turned on, the ...
0
votes
1answer
862 views

Redirect sub-page URLs to parent without changing URL

I am having an issue with redirect rules for a single-page app that is on a sub-page of a Wordpress site. I have followed this set of instructions pretty directly and am still having issues: Redirect ...
2
votes
0answers
120 views

Gutenberg Blocks doesn't render correctly when using do_blocks

I'm trying to render a post_content with blocks using the do_blocks function, that takes a gutenberg content, parses every block, and returns an HTML string. The problem is that some blocks aren't ...
3
votes
2answers
478 views

How to load translation in JavaScript?

I am struggling to load translation in JavaScript for my simple plugin. Translation works for PHP, but not in JS. What seems to be the problem, how can I debug this? I have loaded text domain in my ...
0
votes
1answer
608 views

Help wiht adding fullcalendar.io to a WordPress page

I've been trying to add this calendar to my wordpress page. And I've followed the documentation, but it's still not showing up. This is what I've done. I first added this to my child theme functions ...
1
vote
0answers
21 views

WASM page in Wordpress website

I used emscripten to generate some html/js/wasm/data files and would like to add that as a page to my (Wordpress) website. Is this possible? If so, how?
1
vote
0answers
10 views

Customize Theme comment template to Insert VoteUp and VoteDown buttons

I am using a theme that has an okay comment template that I would not want to change. However I just want to insert voteup and votedown button directly below the User avartar <ul class="...
0
votes
2answers
6k views

How to solve Blocked a frame with origin from accessing a cross origin frame error in wordpress?

I am working on a WordPress website in which there are a lot of wordpress plugins installed. The plugins installed on the wordpress website has the following options: When I click on View details ...
1
vote
1answer
581 views

Call post-id from URL hash not working?

I'm trying to have a modal box open by default when calling it by its id. For example, if i enter the url www.mysite.com#post-28 (#post28 being the ID of the post) I will land with the moadal box ...
0
votes
0answers
32 views

Fade-in Fade-out doesn't work in Wordpress

I have back-to-top script with an arrow icon which appears when scrolling down and disappears when the page content is on top. Works perfect, but when I insert the script in Wordpress the scrollTop ...
0
votes
1answer
15 views

Edit Post Permalink option removed, looking for possible causes

The edit post permalink button is totally removed ( not hidden with css ) from the edit view - but the slug is still editable from both the Quick Edit view and also via the "slug" panel ...
1
vote
2answers
2k views

Conditional fields in contact form 7 not working

In my contact form I need a drop down for order quantities. On selection of "other", I want to display a number field for input. Below is my code but it's not working. Can anyone help? Thanks in ...
0
votes
0answers
77 views

Override a function on editor.js file on Elementor [closed]

I'm working on a Elementor Project, I need urgent help to add few devices here. Since, 'editor.min.js' is on Elementor core file, but I need to add/Override few lines on this file. What I've doing - ...
0
votes
1answer
18 views

AJAX Load more on CPT returning random posts

i have pieced together a post grid loop with AJAX Load More button for posts from a CPT category but I cant get the offset to work properly. There are supposed to be 6 posts per page but at the moment ...
1
vote
0answers
15 views

Authentication with the Rest API when using an External Application

Good day! I'm new to rest api. My task: to make authorization and management of user meta-information on WordPress. More specifically: I write games in html5 (in fact, this is a Java script), and I ...
1
vote
1answer
421 views

Ajax Modal Flickers When Opened Multiple Times

on my Wordpress site I add a button that when clicked calls a modal to open via ajax. When I click the button once on a fresh reload of the page it seems to work fine without any hiccups. If I close ...
1
vote
1answer
713 views

Make a list with header and subtext in Gutenberg blocks

I want to create a block in the gutenberg editor, to create lists with a header and subtext (interview format with question and answer). The list should be in an ordered list. I can't figure out how ...
0
votes
1answer
30 views

JS working when used normally but not in wordpress

I have a shortcode that prints a simple form, a button is used to submit the form. The problem is that when it's pressed, the form gets submitted normally, ignoring the js function. I can't understand ...
0
votes
1answer
957 views

Gutenberg Edit Block Inspector Controls and save

I am looking to edit an existing block to add inspector controls that save as meta data. I have been beating my head trying to find how to save the data. The following code adds a text field to the ...
1
vote
1answer
1k views

Ajax load more button for comments wordpress

I have my own Ajax load more button system but for posts now i decide to make the same thing but for comments so after check get_comments i found that i can't get the CURRENT page of comments like ...
0
votes
0answers
26 views

Getting and setting CSS variables with JQuery in WordPress backend fails

On a WordPress settings page of a plugin I develop, I have to implement a visual element that I want to change by JavaScript. I've got my solution working as it should and tested it on code-pen and ...
3
votes
1answer
521 views

preserve url parameters from affliliate sites

Please help, I am using a wp site as medium between e.g. a news site lets call it A and the actual site that e.g. sells a particular product lets call it B. A ---- medium site --- B news site ---- ...
0
votes
0answers
8 views

Randomizing Wordpress Custom Post Type Sorting Through Them Without Page Refresh

So in essence, we have a custom post type to create quotes - we can pull them up and randomize on page refresh normally, however when it comes to getting them to refresh to a new random quote, every ...
0
votes
1answer
1k views

REST API: Display Category names in JSON?

Using the Wordpress REST API, I retrieve all my posts into a Angular 6 service. The category field in the JSON displays the ID of the category as an array of numbers. "category": [ 6 ], Is there a ...
0
votes
1answer
652 views

Using the WordPress and WooCommerce REST APIs in the same Node app

I am writing a small utility app that connects a 3rd party API to a WooCommerce store (actually, it's multisite, but that's not really relevant) in order to update customer records. The WooCommerce ...
0
votes
2answers
1k views

Cannot successfully execute AJAX script to call function.php specific function. Using XAMPP localhost to test

I've been trying to grasp AJAX for the past 12 hours and i'm slowly losing it. How can I simply pass two basic input dates via form or any other means, not refresh the page, and have it execute the ...
0
votes
1answer
254 views

How to allow download url redirection only if user logged in Wordpress site?

I'm trying to allow url-redirection (from /dl urls) only if user is logged-in to wordpress site. Otherwise don't allow. However it went "page not found" when i click these urls with or without logging ...
0
votes
1answer
615 views

How to load jQuery in TOP of wp_footer?

I have added this code to load Google hosted jQuery function replace_jquery() { if (!is_admin()) { wp_register_script('jquery', 'https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery....
0
votes
1answer
922 views

Return 'X-WP-Total' from headers in response

I'm wondering if it's yet possible to get the value of 'X-WP-Total' in the api response. Here is my request - axios.get(${url}/wp-json/wp/v2/media?per_page=100&mime_type=image/jpeg).then(...
1
vote
1answer
26 views

My Button Default Click Is Not Working In WordPress Using Javascript Code

I have added 2 buttons in my page and I have added the default button click code using javascript but it is not working. This is my HTML code: <button class="tablink" onclick="...
0
votes
0answers
15 views

Search media with javascript

For testing purposed I want to search through the media of the featured image. But I can't seem to activate the search. From the admin product detail page I now have: // open featured image document....
1
vote
1answer
574 views

Trouble with Wordpress Ajax Login System - 302

I'm trying to create a simple Ajax Login system with Wordpress. Unfortunately, every time the "wp_signon" function is fired, my system failed and the only information I have is this one : POST myurl/...
0
votes
0answers
13 views

Add page visit and link clicking tracking to plugin

I am currently making a plugin that needs to be able to pull the page visit statistics and link clicking statistics in order to display them in an admin interface. I have the pages being assigned to ...
2
votes
1answer
734 views

Gutenberg block “This block appears to have been modified externally” on save

Just starting to play with Gutenberg block development, and I am building a very simple button (yes I know buttons are already included, but this block will have lots of settings and classes not ...
7
votes
1answer
1k views

How to pass/get data to/from the WooCommerce data-product_variations object?

What is the best way to pass/get data to/from the data-product_variations attr form in Product Single pages. I am working on some interactions with the product gallery images and the product ...

1
2 3 4 5
45