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 to include a JSON file on my page?

I have a JSON file stored in my child theme directory: file.json). Separately, the PHP template for my page contains some JavaScript code (in the form of a <script> tag). In that JS code, I ...
0
votes
0answers
10 views

Close video stick - Single Post

I'm trying to fix this problem that I have with this sticky video but I can't seem to find a solution. I have two video's on my page. One is sticky and the other sits at the top. I want the sticky ...
0
votes
1answer
16 views

I am trying to add current logged in user to my zoho chat

I am trying to get user info auto populated into the chat fields so logged in users don't have to type in their information everytime they want to chat with us. I cant seem to figure out how to make ...
0
votes
1answer
23 views

Why wp_ajax hooks doesn't work?

I need to execute the Php function from my Ajax form with the POST method. Is there another way instead of ajax hooks? Hooks doesn't execute. Always returning 0. What's wrong? Here's my ajax.js '...
0
votes
0answers
17 views

I am trying to Implement a Code that is Working in my previous page but not working in Wordpress for some reason

For some reason the Console says that the "jQuery is not Defined". And it is not working... And here is the Code: CSS: body { background-color: rgb(176,176,176) !important; } .opala { ...
1
vote
1answer
12 views

Filter medias from the Media Uploader (wp.media) modal with a post meta

I would like to have a media uploader modal that displays only image medias having a specific post meta, let's say 'my_image_meta'. How could I achieve this ? Here's my actual code, which just filters ...
0
votes
1answer
15 views

Add “onclick” option to header menu item

on my website I have a problem. In my menù I have a voice called "area riservata". What I want to do is: insert a condition on this specific voice, so when a user click on this voice a not logged-in ...
0
votes
0answers
9 views

Bootstrap 4 Optimization

I installed all bootstrap links to my theme.I use bootstrap lowly; generally for grid system.How can I learn which link do I must install or not? Also I want to learn is my installation good or is ...
0
votes
0answers
19 views

Cannot Add Two Scripts to Header

I am trying to add two scripts to the header of my site. I can install a single script, such as this: <script type="text/javascript">console.log("testA")</script> I am not able to add ...
0
votes
0answers
14 views

Javascript to create photo galley from share folder

Hello I am looking for a Javascript code that can pull all photos from my share folder into a webpage. All photos are named as dates in a format yyyy-mm-dd. For example 2020-01-25.JPG (unfortunately ...
0
votes
0answers
13 views

Create Metaboxes dynamically in admin for Pages

I've created in the admin editor of my site homepage a Metabox with an input and a textarea fields. The code works great. However my goal is to allow the admin user to duplicate the Metabox with the ...
0
votes
0answers
26 views

How to save/post javascript variable to usermeta

I built a simple math game for my son using javascript so he can practice his math facts. I want to be able to save and track his high scores using the usermeta table, but I am having trouble ...
0
votes
0answers
18 views

Print stars (half, full, empty) according to WordPress plugin rating

So the WordPress Repo API returns a column called: author_block_rating And I'd like to calculate amount of stars just like they are ouputted if you search for a plugin: I have tried with this piece ...
0
votes
1answer
14 views

Make fields required on hidden Contact Form 7 fields

I'm using some form fields to gather contact information and then populating CF7 hidden fields with javascript. It all works great, however the user is able to send the forms without filling out ...
0
votes
1answer
23 views

How to use posts as tabs in a custom page?

everyone. I'm a beginner at coding/Wordpress and need some help with a custom page I'm developing right now. The idea is simple: A list of items on the left An image with a description below on the ...
0
votes
0answers
12 views

How to get Angular app working in Wordpress plugin?

I am working on a project that requires Angular to be loaded in a Wordpress plugin, and am running into some snage getting it working. After some trial and error, the final error I ran into was: main-...
0
votes
0answers
11 views

Content-Policy and Inline javascript/css

So I'm using wp_localize_script which I need for some javascript I'm running on the front. However the variable is that holds the information from localize_script (we'll call this variable "site" for ...
0
votes
0answers
20 views

Dropdown menu not close after click inside

On my WordPress website I have a dropdown menu which appear when you click on item-menu "ESPACE PUBLIC" with 2 sub-menus ("TOUS LES PROJETS" and "CORNIL"). When I click on one sub-menu I get ...
0
votes
0answers
14 views

Add extra cost to shipping method itself in woocommerce

I found the following code from this link: https://stackoverflow.com/questions/52138784/add-a-fee-based-on-shipping-method-and-payment-method-in-woocommerce The code works great if you want to add ...
0
votes
1answer
25 views

I have a lot of JavaScript erorrs after SSL someone can help me?

I have a lot of JavaScript errors after SSL. Can someone help me? (https://validator.w3.org/nu/?doc=https%3A%2F%2Ffashionbymichal.com%2Fhe%2F) Also in the console: https://prnt.sc/qmnnzh
0
votes
0answers
20 views

$.ajax results in 403 forbidden

I am trying to fetch debug information from a piece of javascript, to make it easier to copy the debug information code (if find my self often doing this). However, when I send a request to a page, ...
0
votes
1answer
11 views

Multiple image selection custom widget

I've created a swiper custom carousel as template part of a custom theme. I want to widgetize this component of the theme to have more control over the contents displayed. It's used as an horizontal ...
0
votes
0answers
23 views

When adding google tag script in website, functionality not working

When i add google tag manager script in my wordpress website, user login, checkout functionalities facing issue.I tried with child theme as well as added script using plugins (google-tag-manage, ...
0
votes
0answers
30 views

Execute inline javascript in wordpress after page fully loaded

I am trying to find out the time it takes to fully load a page in wordpress using javascript.My JavaScript code is inline.I am using wp_print_scripts hook but as it prints scripts in document head i ...
0
votes
1answer
19 views

Is there a loading priority for login_enqueue_scripts?

I'm using this function to load my plugins (custom-logo-and-login) Javascript file in the footer of the login.php page, but the file loads right before the wp-includes main jQuery library: add_action(...
-1
votes
0answers
21 views

Set Default Value by two fields(attribute) in WordPress

I have some several fields in custom post code name ..... .... code name search(combination of code and name) -->Make field "Read Only" in UI anyway to concatenate code+name into 3rd attribute(code ...
0
votes
0answers
20 views

Vue and wordpress.Bad Request ajax request

First off, I'm not using wp in REST API mode. I'm simply using vue for an UI I wrote for an custom admin page. I'm using a development server spun up from webpack, I enqueue the scripts as so: ...
0
votes
1answer
30 views

Media library not working with wp_editor() on the front end

Very related: Add Media has stopped working in the front end since 4.5 update I want to run the wp_editor() function to load the classic WordPress editor on the Front-End. I need to do this out of ...
0
votes
0answers
11 views

Using a vue development (spun up by parcel.js) server with wordpress

I'm trying to develop an admin ui for a custom admin page using vue. I'm using Using the following article: https://premium.wpmudev.org/blog/creating-a-hybrid-single-page-app-wordpress-with-vuejs/ ...
0
votes
0answers
19 views

How to bridge the gap between dynamic back-end data and front-end output?

I wish to allow people to extend my system in any way they want while maintaining its integrity. For example, I have a component in my plugin called Notifications. These notifications are output to ...
0
votes
0answers
19 views

setInterval is not working in child js file

I am trying to use setInterval() into a script.js in a child theme. that was added in the functions.php child, any console.log() is working so the file is well linked. this is how I am using the ...
1
vote
0answers
36 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
0answers
10 views

How can i remove one img src for existing and future post?

I have <img src="ex.jpg" alt="ex"/> any code to remove this image so i can set right first image as thumbnail
0
votes
1answer
18 views

The script works only once by clicking on the opening and closing

What is wrong with my code? What needs to be fixed so that the script always works on clicks of buttons? <script type="text/javascript"> // Выполнить асинхронный Ajax-запрос с помощью метода ...
0
votes
0answers
5 views

Custom block - check if post exists

I have custom block with saved attr of post ID. How can I verify from block definition that post with that ID exists in Wordpres. My aim is to warn user if post with saved ID exists no more.
0
votes
0answers
17 views

Wordpress Slider is not working

Currently I am developing my first theme in wordpress by converting html. In my front page (front-page.php in wordpress) there is a slide. It was finely working with html. But when I place it in the ...
1
vote
1answer
25 views

Modifying a .js Function for Print [QZ Tray, WooCommerce POS]

I'm sure this is an easy question, but I'm struggling to understand what I'm missing here. Skip to the bottom for the actual questions. Background I'm modifying a Wordpress POS plugin to work with ...
0
votes
0answers
18 views

Integrate leaflet / Openstreetmap autocomplete functionality to an existing search form on a wordpress template

I am trying to add the autocomplete functionality similar to what you have here https://community.algolia.com/places/examples.html#advanced to the search form in my website. Unfortunately there are no ...
0
votes
0answers
58 views

Calling php function using button onclick

I am using the following html button <button onclick="ga_cal_change_status(2300)"/> and I want to call the "my_message" php function from onclick event ga_cal_change_status(2300) passing the ...
0
votes
1answer
15 views

React to AJAX adding to the page

How can I have my JavaScript run every time AJAX finishes adding content to the page? My JavaScript file loads and runs, but only on first page load. I'm looking for the equivalent of Drupal....
0
votes
0answers
17 views

Multiple shortcodes with embedded JavaScript code in same page, how?

I'm developing a plugin that use shortcodes to display some "special" buttons on frontend. These shortcodes generate HTML, CSS and JavaScript for the button so, if the user insert multiple shortcodes ...
0
votes
1answer
25 views

Load script on frontend from widget plugin

I need a bit of help for a plugin I'm writing. I need to load a custom stylesheet and a custom script that are needed on the frontend only. Usually I use the wp_enqueue_script and wp_enqueue_style ...
1
vote
0answers
51 views

adding a script with type=“module” to woocommerce admin area

I'm trying to connect a my brother QL-800 label printer to a woocommerce webshop admin page open order, click address, print it. brother provides a javascript library (b-pac: https://www.brother.co....
0
votes
1answer
20 views

Is it feasible to call angular's page from wordpress website?

I have a static website on WordPress and there are 2 to 3 pages which has dynamic content and which does requires user authentication. So can I build these pages on angular side and call these pages ...
1
vote
0answers
29 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 ...
2
votes
0answers
22 views

How to handle Gutenberg wp.data async errors?

When using wp.data.select('core').getEntityRecords(...), there is a special selector for loading states wp.data.select('core/data').isResolving(...). But what about actual errors -- backend validation ...
1
vote
1answer
15 views

wp_enqueue_scripts leads to error

I am adding a javascript file by hooking into wp_enqueue_scripts(). Here's the code: function order_tracking() { global $post; if ( $post->ID == 19851 ) { wp_enqueue_script('...
1
vote
1answer
36 views

How to filter a table in post content without plugins? [closed]

I found this feature Filter/Search Table in W3schools from this link https://www.w3schools.com/howto/howto_js_filter_table.asp I had tried to use it in my wordpress page content. The problem here is ...
1
vote
0answers
24 views

How to add material design css in wordpress and woocommerce

I am creating theme from scratch. I want to add material design css / forms / components and style in my theme. Can someone please assist me how to start. How can I disable default wordpress and ...
1
vote
0answers
10 views

Javascript file is not working on single.php wordpress [closed]

i have been included javascript file with wp_enqueue_script in function.php. it's working on index.php, but not working on single.php. does anyone have a solution???