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
20 views

Performing CRUD operations on front end in wordpress

I'm currently trying to create a system where I can perform CRUD operations on a wordpress front end. I've seen a few plugins with shortcodes that allow this, so that is one possibility. However, ...
1
vote
1answer
31 views

Enqueue scripts all over but not in single.php

I need to insert this script in the footer on the home, in categories, in pages, in the tags in the search but NOT in single.php: function live_search() { wp_enqueue_script('live_search', ...
0
votes
1answer
11 views

Deregister dequeue JS scripts except on 1 product page

I need to deregister JS scripts everywhere except on one product page, so far this is my code: add_action( 'wp_print_scripts', 'my_deregister_javascript', 100 ); if ( !is_product('67688') ) { ...
0
votes
0answers
18 views

No plugin css or scripts loading. My custom WooCommerce site lacked functionability

Actually, I am designing a custom WooCommerce theme from scratch. I added the default functionality of WooCommerce through functions.php and started designing the site. Now, everything works fine ...
0
votes
0answers
12 views

How do you change the text “Update failed. You are probably offline.” <- can't seem to change this default text in my wordpress

How do you change the text "Update failed. You are probably offline." <- can't seem to change this default text in my wordpress. Doing grep -rnH 'You are probably offline' . gets ...
0
votes
1answer
13 views

Status 400 for AJAX POST Request with admin-ajax.php

I've been on this problem since yesterday, writing and rewriting my code to fix this 400 XRH error. I cannot find a way to fix it. Before showing you the code, here's some context: I am trying to add ...
0
votes
0answers
9 views

Sending referrer URL via WordPress AJAX in vanilla JS

Let's say you have a form. On submit, you coded the page to submit the form data to a given data base, by holding the data in a json object, like so: myData = {first_value: value1, second_value: ...
0
votes
0answers
10 views

Use WordPress Shortcodes in TinyMCE5

I am using Wordpress on my site. I wanted a visual editor on frontend of my site. Gutenburg isnt allowed to be put on frontend, and visual editor looks old, so directly using TinyMCE was the best ...
0
votes
1answer
22 views

URL issue retrieving Custom Post Types using Backbone JS API

I have a Custom Post Type called pronews. I registered it with show_in_rest enabled. I'm using WordPress 5.5. I then have this code: export const ProPost = wp.api.models.Post.extend( { urlRoot: ...
0
votes
0answers
10 views

How to play vimeo video from last position [closed]

I am looking for a solution on how to resume vimeo videos from last position a user watched. Is there any tutorial on that? Regards
1
vote
1answer
14 views

Time consuming callbacks in customizer

I am having a custom state ex. 'visibility-state' which having values as true | false. I am binding this state to all the settings and settings are in 1000+ numbers. SO when the state changes it is ...
0
votes
0answers
11 views

add mediaelement.js plugins into WordPress video player control bar

im trying to add SkipBack and JumpForward Plugin of mediaelement.js into my wordpress [video] tag controlbar. so far i have added those to plugin js in a js file (videoplayerjs) like this : /*! * ...
0
votes
0answers
10 views

WP - Best way to store theme colors to use in SASS/SCSS, JSX (blocks) and PHP [duplicate]

I want to have a way to change theme colors once and use them in SCSS, JSX and PHP. Right now I have the theme colors in my variables.scss like: $theme-colors: ( base: #fff, primary: #5bb57a, ...
0
votes
0answers
7 views

jQuery set fixed length content in div

i m stuck into one situation, i have a div having some paragraph content. i only want to show 100 words of content in div for example - (sometextjonty) i only want to show 7 alphabets content in div ...
0
votes
0answers
16 views

Displaying an interactive web map on my wordpress site

I created an interactive web map using Javascript, and want to display it on my Wordpress site. I am currently displaying it on a browser webpage. Things to note, the map uses data from a .csv file ...
0
votes
1answer
16 views

How to Change CSS Colors from Custom Plugin Settings Page

I have a custom WordPress plugin with a variety of settings that I use across multiple websites. I also use a few of the same 3rd party plugins across all of those pages. I would like to be able to ...
0
votes
0answers
69 views

Uncaught TypeError: r is not a function

I built a plugin that registers a Gutenberg block that prints a simple Mailchimp form. The plugin works with no issues. But, if I activate Jetpack and try to edit any page or post, I get a blank ...
2
votes
1answer
16 views

How to show cities according to the state in Form using Javascript? [closed]

I am working on the Contact Form 7 and I want to show the cities according to state in contact form 7. I have also used the plugin but it is not working according to the condition and I don't want the ...
0
votes
1answer
18 views

Replace script attr or link

Hello friends i have this <script type="text/javascript" src="https://thompsonlaw.formstack.com/forms/js.php/tho_lionlaw_com_v2"></script> form link in many wordpress ...
0
votes
0answers
8 views

Extending core gutenberg block with attributes

so i created a custom plugin that should extend the core/video gutenberg block. the plan is, to disable video download. so disable the context menu and also add the widly unsupported but anyhow ...
0
votes
1answer
39 views

Nothing in dashboard that uses javascript works

I cannot see the media I have uploaded under the Media Library--it's a blank space(though I can upload with the html uploader ). I cannot use the Select All checkbox to select all the plugins on the ...
0
votes
0answers
13 views

Download Excel (phpExcel) by clicking the button

I am trying to download an Excel using the phpExcel library only when it receives a $ _POST parameter. Currently I have a file called my-information.php where I have a table and a button that executes ...
0
votes
0answers
11 views

How to use setAttributes outside of the edit function return

This is probably as simple case of either not understanding JavaScript/ESNext scoping or function passing (or both), but, I can't get setAttributes to work outside of the primary "return" of ...
0
votes
2answers
38 views

why is apiFetch throwing Unhandled Promise Rejection: TypeError: Object is not a function

I'm trying to diagnose a similar problem to this question, but in that case he wasn't depending on wp-api-fetch, and ... I'm pretty sure I am. I'm getting the following error: [Error] Unhandled ...
0
votes
0answers
17 views

How to add specific script to WordPress webpage that will working with user input and databases

We are new to WordPress and want to create Website that will be taking user input, running specific script through databases using that input and then outputting specific results on the web-page or ...
0
votes
1answer
14 views

Built-in image lazy loading: Does it come with a polyfill for older browsers?

It's neat that WordPress now automatically adds the loading="lazy" attribute to images. My question is: Does WP now also have a built-in JS polyfill for browsers that don't support the ...
0
votes
0answers
13 views

jQuery Pjax page transition - initialise page after transition

some how my page design is distroyed after Jquery pjax transition. i use barba.js . onload everything i ok. but after transition page design is distroyed. in simple html website my transition work ...
0
votes
0answers
18 views

Best way to implement 3rd party JavasScript to render content on page

I am using a 3rd party service to render a booking calendar on one of my pages. They don't have an implementation specific for Wordpress. They just provide a couple lines of code and say to put them ...
1
vote
1answer
37 views

Add attribute to script loaded by the theme

I was looking for a method to add the data-cfasync="false" attribute to a javascript loaded by the theme itself. My theme load the script <script type="e350ac6f596d90da70624b6d-text/...
0
votes
1answer
41 views

`wp_set_script_translations` with `wp.i18n` does not return translated strings in simple plugin

Short description: I try to translate strings in JS file. To test it I decided to create a simple test plugin. I have PHP and JS strings there. Translated PHP strings work fine, JS strings don't work. ...
0
votes
0answers
11 views

How do I add a div class to the posts in a filter and not the entire filter element?

I am having some troubles with the Isotope filter gallery, as discussed in my Stackoverflow question here. As per the first point of the accepted answer, I need to add the class .isotope, to the ...
0
votes
1answer
36 views

How to generate the COOKIEHASH from JavaScript

The overarching question How do I get the contents of the PHP-variable: COOKIEHASH inside a Cypress-test. I'm writing some Cypress-test for WordPress, and in order to set the cookies to log in a user ...
1
vote
0answers
14 views

How to inject variables into public-facing JS using wp_enqueue_script

I'm using wp_enqueue_script to enqueue the public-facing JS of my WP plugin: wp_enqueue_script($this->PluginName, plugin_dir_url(__FILE__) . 'js/public.js', array(), $this->version, false); And ...
0
votes
1answer
12 views

woocommerce deposit Form with AJAX and shortcode won't update but add to previous output

I am trying to create a product page where selecting a field defines a product and this triggers an AJAX call to display the woocommerce deposit form and add to cart submit button that correspond to ...
1
vote
1answer
41 views

Vimeo froogaloop

Very much a newbie here, but I'm trying to use this idea to disable forward seeking in Vimeo clips embedded on a Wordpress site To my functions.php I've added function frogaloop_scripts() { ...
0
votes
1answer
36 views

Passing the name of selected color from the custom <ColorPalette/> component to `render_callback`

I have a custom block with the ColorPalette component. In this component, I have an array with several colors to choose from. The ColorPalette component only passes a color value. I would like to pass ...
2
votes
0answers
47 views

Is there a core Sortable component in Gutenberg?

I managed to somewhat replicate the product gallery metabox from WooCommerce in Gutenberg using the third-party react-sortable-hoc component. As it seems that this component is no longer supported, I'...
0
votes
0answers
13 views

Creating a User-Adjustable chart in Wordpress

I am new to WordPress and I need to create a 'calculator/chart'. I have an excel file with a chart whose values are pulled from different tables with separate formulas, each table having its own set ...
0
votes
1answer
38 views

How to properly enqueue jQuery knob on Wordpress without conflict?

I'm building a plugin and I want to use jQuery Knob but it seems like using this method: plugins_url( '/assets/js/jquery.knob.min.js, . . . . . Have conflicts with other plugins? How to convert it ...
0
votes
1answer
67 views

on change form submit variable value not updating

I try to make custom theme option, a switch select option can change $bannerchange value. but i cannot add/update value of $bannerchange, select option inside a form. working fine with submit button ...
0
votes
0answers
9 views

How can I Reuse the media uploader for the block editor

I am building a theme and I want to create a new gallery block type for it without interfering with the original one. For the editor side, I would like to maintain the same interface as the inbuilt ...
0
votes
2answers
71 views

Ajax Call not Working in Plugin

I've been developing a website using WP and to display some database information in the front-end of the site i've created a plugin. Right now i want to include a filtering function for that same ...
0
votes
0answers
9 views

How to add smooth scroll and scroll to top like static code into dynamic Wordpress menu

Here is my static code of menu I want to add (scroll-to-top) and (smooth-scroll) like below to my wordpress nav menu <ul class="site-navigation__list"> <li><a href="#&...
2
votes
0answers
20 views

using woocommerce_template_single_add_to_cart in shop-loop - javascript issues [closed]

We want to show product variations on all product tiles, in all views. I have some code using woocommerce hooks added to functions.php (see below) that does the trick visually but we have several ...
0
votes
0answers
15 views

Ajax load more scroll to new(loaded) posts

On my recent website, i have tried to add ajax load more to load more news. Its working but when i click the load more button need to scroll up to see the loaded posts. Link: https://www.theoriatest....
1
vote
1answer
21 views

Older isotope portfolio rows shifting downward by 1 pixel on hover

https://visaud.io/shows/ Please see the above link. As you'll see, if you hover over the portfolio items, they either shift to the next column/line (in the case of columns 1-3) or shift all the ...
0
votes
0answers
46 views

separate list of programs in html/javascript coming from php

I have a html/php code as shown below which displays list of links coming from wordpress. html/php: <header class="entry-header container grid-flex"> <div class="flex-item -...
0
votes
1answer
22 views

Custom Gutenberg-Block esnext pass variables

I am trying to create a Block with @wordpress/create-block, for this you have to use exnext. I`m not pretty good with JS at the moment, still learning. So far it is working (the block appears in the ...
0
votes
0answers
31 views

WP Blocks - How to put a <span> inside the heading block using addfilter

I'm trying to add a css effect to the headers. For this the content of the h1, h2 etc elements should be wrapped in span elements. So from <h1>hello world</h1> to <h1><span>...
0
votes
0answers
63 views

Gutenberg Block Editor - Create block with dynamic content

The official docs has a example of creating a demo block. The example has an edit.js and save.js for creating an editor view and front end view. Assuming I want to create a block that prints a list of ...

1
2 3 4 5
46