Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

A client side scripting language useful for making interactive web sites

0
votes
1answer
12 views

Conditionally change a hyperlink url based on user role

I am looking for a way to change the destination URL of a hyperlink based on the logged in user's user role. I will have 3 custom user roles: Persona 1 Persona 2 Persona 3 The website will be a ...
0
votes
1answer
15 views

custom post type column countdown

i have registered custom post type and i have created custom columns for it one of those columns is count down it's functionality to cut the NowTime from the custom meta date and time i have set ...
0
votes
0answers
21 views

Setting HTML properties in a Gutenberg plugin using WordPress settings

I want to set the maxlength property on a TextControl I define in a Gutenberg plugin. This length is to be set from a setting in my WordPress plugin (the one that loads the Gutenberg plugin). I ...
0
votes
1answer
16 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
votes
0answers
15 views

only for javascript enabled browsers [on hold]

Is there any way to show your wordpress site only to those users who have enabled javascript on their browsers? some plugins etc. while hiding from it from those who have disabled javascript :)
0
votes
0answers
8 views

I need help To display Posts From A Specific Category or tag In my homepage Mobile theme [on hold]

Hello Guys Am Trying to Display Posts From Different categories on my mobile site Home Page But I end Up breaking my site With Wrong Code This is My site https://bazenation.co/ This Is What I want ...
0
votes
0answers
12 views

how to display data from toolset custom fields into wp_head as json-ld jobschema format only in CPT 'Jobs'

i am using toolset types plugin and genesis framework. i created custom fields for a CPT Jobs using toolset plugin. Now i want to display these fields data as jobposting schema json-ld format into my ...
0
votes
1answer
11 views

Landing function through URL

I have a landing page with 3 buttons that have respective functions with them to hide/unhide content based on user selection of those three buttons. Is there a way I can have the user land directly ...
0
votes
0answers
7 views

Thank you page redirect to same after successful submission and the form is overlapped with thank you display in complete width of the form present

Anyone please help <script> function limitText(limitField, limitCount, limitNum) { if (limitField.value.length > limitNum) { limitField.value = limitField....
-1
votes
0answers
20 views

Grid content image

it's simple I wanna do this: https://www.allopsm.fr/devis-marque/ a grid with image and when you click it's open another grid on the same page. I think it's javascript ou jQuery, but what I'm asking ...
0
votes
1answer
17 views

How can I add tinymce editor in Wordpress with jQuery?

I need to add a tinymce editor with a jQuery function. I know that tinymce is a js based editor so there need to be a way to do something like this: <div class="container"> <div class"...
0
votes
1answer
28 views

Ajax in Plugins: returns the whole page

I'm developing a small plugin for a client and my ajax calls returns the whole page as json response. I cannot find the bug. In the plugin main.php: function __construct(){ //.. $this->...
0
votes
2answers
19 views

Changes to JS not reflected on site

I want to edit the JS file, however, any cahnges that I make do not appear on website. I added a simple: console.log("hello world"); When looking at the head of the document, I can find the .js ...
0
votes
0answers
11 views

Adding Help “?” icon to the registration page

I want to add the "?" to my registration page https://www.smartaspelare.se/registrera/ and want to make it look like the image attached . Clicking on the "?" should show some custom message as well.
0
votes
1answer
13 views

How to round div width and height to nearest even numbers using Math.round() in javascript? [closed]

I'm writing a template. However the problem I'm facing is that the words in the div are not clear to read. Later I found if the width or height of that div is not even number, for example width:...
1
vote
1answer
21 views

WP REST API Post Status Using JavaScript

I am getting my hands dirty in WP REST API. I have gone through a couple of tutorials and have a question using JavaScript to create a new post. In this tutorial, the post var status = 'draft'; (see ...
0
votes
0answers
16 views

How to use styled-components within a custom Gutenberg block?

I'd like to use styled-components with a custom Gutenberg block that I've created. The CSS class is added by styled-components, but there is no CSS style defined for that class in either the editor ...
0
votes
1answer
34 views

How to add close button to dropdown menu that also reverts to menu button on another click

I am creating a custom dropdown menu for my WordPress blog header. I did everything correctly but could not add close button that opens on first click and revert to default on another click. I mean ...
0
votes
0answers
11 views

How to connect javascript to certain elements when creating an admin theme

This may be a stupid question, but it will be easier for you to answer it. I'm not an expert, but I really want to be. In General, I create my own wordpress admin theme. I've figured out how to ...
0
votes
0answers
20 views

Shifting one element in woocommerce cart table

So I have a plugin which provides two custom thumbnails and some other information in the cart table for checkout for that product, however it does not replace the original thumbnail so its as though ...
0
votes
0answers
19 views

How to use {{{ data }}} value into a javascript variable?

I have a line of code which I think is a js template placeholder when I use it like this it returns the value that I need "the price of a product" ?> {{{ data.variation.amz_price_var_uk }}} <?...
0
votes
1answer
26 views

Dropdown (with onChange) with custom taxonomies

I have multi-select taxonomy field A. When one or more values are selected in A, I want to restrict the choices available in taxonomy field B. So for example: Two Taxonomies called country - "USA", ...
0
votes
1answer
45 views

Gutenberg consume wp-json data and reflect in frontend the content

I have a custom gutenberg block which is dynamically fetching custom post data via wp-json on edit. How do I persevere the data on save for the fronted? here is my custom component (preview.js) which ...
0
votes
0answers
12 views

Ajax form - Front End PM plugin

I am using the Front End PM plugin and I am trying to convert the reply messages form and the create a new message form to submit by AJAX but I am having a bit of difficulty trying to figure out how ...
0
votes
2answers
17 views

Enabling plugin on specific pages and subpages

To increase the loading speed, I would like to only enable Event Manager plugin on the pages where it's actually used. For that, I wrote this piece of code: // deregister unnecessary plugin scripts: ...
0
votes
1answer
29 views

How to speed up admin-ajax.php in wordpress

I have some code on functions.php that I call via ajax on frontend, I'm using admin-ajax which takes about 2 to 2.5 seconds to load since I have many plugins and that ajax handler need to load all wp ...
0
votes
1answer
30 views

How to echo a PHP code into WooCommerce variation product?

I have a little complex to explain the problem which I hope someone can understand and help me with. I have set custom fields on WooCommerce which I use to enter a specific code for each product (...
0
votes
0answers
28 views

Error handling for wpdb error - displaying an error message to the user

I want to display an error message to a user when a php POST form fails. The form lets a user create a new team on my site. If the team name is not unique, the query fails. I want to display a generic ...
-1
votes
0answers
11 views

JS Iframe being dumped below footer

A very limited question here. I have a widget from OpenTable which uses a script source to load the iframe in to the page. <script type='text/javascript' src='//www.opentable.co.uk/widget/...
0
votes
1answer
13 views

How To Display Author Popup on Entry Meta (Genesis Framework)?

How to when the mouse pointer on the author name can display Author Popup like this site? https://www.dietdoctor.com/low-carb/keto Thank you!
0
votes
1answer
26 views

How can i get the same ajax result using WP REST API instead of admin-ajax?

I have been told that admin-ajax is outdated now and it's better to use REST API instead but I was wondering how can I get the same result of this code which generates a button with a link based on ...
0
votes
0answers
10 views

Trying to make a dropdown menu with closebtn. please help

I am new to coding in WordPress. I am actually making a custom theme where I want a dropdown menu in header. I like Moz.com and Neilpatel.com's drop down menu so much. I tried to code one like that ...
0
votes
1answer
41 views

Why i can't get custom fields value or post ID via Ajax?

I wrote a code that generate a link based on the visitor location and it worked perfectly but i discovered that the generated code get cached since i'm using a full page caching so i though to solve ...
0
votes
1answer
21 views

JavaScript errors

Recently I just moved my website to new server. it was working fine with the old server. but now after i changed to new server the wordpress layout is collapsed. when i saw the console i have seen ...
0
votes
1answer
23 views

How to call a function from functions.php with ajax?

I'm wondering how can i call a function from functions.php and print it with Ajax in a specific place (woocommerce_before_add_to_cart_button). I know i can simply add my function in add_action like ...
0
votes
0answers
15 views

Random photo size & arrangement for portfolio

I want me make my portfolio page to show different style when the user refresh my page. the picture will display different size randomly e.g. the square image will remain the square image but the ...
-1
votes
1answer
30 views

How to prevent those PHP variables from being cached on WordPress?

I'm using this code in functions.php on WordPress to generate an affiliate link based on the visitor location, It's working perfectly but the problem is that if page caching is turned on (W3 Total ...
0
votes
0answers
28 views

Wordpress Plugins not working - Jquery showing errors

I'm new to the development world and I started by migrating an Html web site to Wordpress theme using a backbone theme. Everything looks good on the website (on localhost & live) but not on my ...
1
vote
1answer
38 views

Weird links found in wordpress footer

I have a wordpress site where i am removing all the http content to get the ssl padlock. I have done that on the main page but some of the article pages of my website has this code in the footer and ...
0
votes
0answers
31 views

Gallery Previews Not Working - wp.editor JavaScript API

When using media buttons on the wp.editor JavaScript API, The default "Create Gallery" functionality is available. Selection and editing of the gallery is working perfectly fine, however the gallery ...
0
votes
0answers
14 views

Wordpress Site URL is added to external links

So my website, What If? HQ, is made with wordpress. Resources load fine on it, however if you click on the twitter link on the mobile site, and if I specify a font resource that is not local via css, ...
0
votes
0answers
24 views

Notification for users based on saved search queries

I have been working on a saved search functionality and it's almost complete, I just need help with the very last part of the equation. I was able to run a wp_query which checks the found_posts of a ...
0
votes
0answers
37 views

Gutenberg - What is the best way to save/update post meta?

What would be the best way in Gutenberg to save/update post meta (not from a block). I can't find an API for it. I was thinking of doing some ajax in componentDidMount using wp.ajax.post Any advice ...
0
votes
1answer
22 views

Speeding up Wordpress on a Local Network

Currently I'm trying to run WordPress offline on a Local Area Network and I'm wondering how to stop WordPress from attempting to load "loader.js?ver=4.9.8" a javascript file from gstatic.com. I've ...
0
votes
0answers
14 views

Heartbeat does not fire as expected (frontend)

I want to use the wordpress heartbeat functionality, because I want to detect if a user is still on the site / on my custom post type site. (Because I want that only one user can be at my custom post ...
0
votes
2answers
247 views

This page can't load Google Maps correctly [closed]

I am trying to get map from address but there are appear some error like You have exceeded your request quota for this API in my console so can anyone help me to fix this. My Javascript code look ...
0
votes
1answer
28 views

Add JS in footer via shortcode?

I have created a shortcode that does some PHP processing, and then returns some javascript; current code is as follows: <?php add_shortcode( 'round_time_to_next_15_min_interval', '...
0
votes
0answers
11 views

Only allow 1 Image to be uploaded at a time

I need to disable multiple uploads at a time. I am using wp.media.frames on the front end of the site, and cannot use upload_prefilter since it would need to check a post for total uploads - which is ...
0
votes
1answer
28 views

Gutenberg - is it ok to load dependencies multiple times?

Gutenberg comes with its own dependencies, lets say React and React DOM... If I'm building a plugin, should I add the same dependencies for it? Wouldn't that mean that it loads React twice and it ...
0
votes
0answers
24 views

Adding javascript:void(0) In wordpress Post And html Widget?

Im trying to use JavaScript anchor inside WordPress post content and text html widget, some of those code are: <a href="#" onClick="javascript:window.location.href='http://www.cnn.com'">News ...