Tag Info

New answers tagged

0

There are a few problems but the main one is when sidebarEffects.js is loaded the HTML it's looking for doesn't exist yet. So... var container = document.getElementById( 'st-container' ) // and buttons = Array.prototype.slice.call( document.querySelectorAll( '#st-trigger-effects > button' ) ) are both empty when the script is run. Easiest way to fix ...


4

If you want to do this via AJAX, on the server side you could do something like the following: add_action( 'wp_ajax_nopriv_update_shortcode_content', 'update_shortcode_content' ); function update_shortcode_content(){ if( !empty( $_GET['new_shortcode_value'] ) ){ $updated_content = do_shortcode( '[theshortcode value="' . ...


0

function enqueue_lazyload() { wp_enqueue_script('jquery_lazy_load', get_stylesheet_directory_uri() . '/js/jquery.lazyload.min.js', array('jquery'), '1.9.1'); } add_action('wp_enqueue_scripts', 'enqueue_lazyload'); Next, we have to add a small bit of Javascript to our footer to get the lazy load plugin to recognize images. You can see how this works on ...


0

I think you can do this by following way - Install the plugin https://wordpress.org/plugins/json-rest-api/ on the site from where you want to pull the posts. It makes the WordPress data available in json format. It is also possible to filter the request to get specific data. You can read the documentation in detail here at http://v2.wp-api.org Look for ...


1

It's a UNIX timestamp - with PHP, you can use date to format it like so: echo date( 'd/m/Y', $timestamp ); // day/month/year


0

A 0 status from admin-ajax.php indicates that no "action" is being parsed. When you enqueue the script you are assigning a handle, this handle needs to be used when you use wp_localize_script and additionally you need to assign the url. https://codex.wordpress.org/Function_Reference/wp_localize_script wp_register_script( 'some_handle', ...


0

Had a similar issue on my site, solved it by creating a single js file with all the scripts that were earlier in the header and footer.. this somehow solved the issue in the inner pages.. Also noticed that I was loading jQuery twice as well, removed the extra jquery file (Note: this did not solve the issue)..


0

Follow the following steps to achieve your result, Use get_terms to fetch all of your parent taxonomies and render a drop-down with the title and setting a data attribute with the term ID. Please set the args "parent" to 0 and taxonomy to your taxonomy slug. Write a jQuery script to fire an AJAX on the above created drop-down. The AJAX should send the ...


0

You can achieve it by the following code. Open you header.php find the following text in that file < !DOCTYPE html> and replace it with the following. <?php /** @package WordPress @subpackage Default_Theme **/ header("Access-Control-Allow-Origin: *"); ?> <! DOCTYPE html> ... Now u can find Access-Control-Allow-Origin: * in ...


0

Oh okay.. I think I solved it. I put the script in the header.php (I think "into the loop" as they say?) just behind the opening <header>-tag: <body> <header> <script type="text/javascript"> (function($) { $(document).ready(function(){ $(window).scroll(function(){ ...


0

since it runs on old jquery ,try adding the old jquery on your footer of your theme, add the jquery manually and add script noconflict. You can get jquery library list from google cdn View Sample


1

There are a number of issues with your code but most importantly you need to call val on the text input. Here is how your make_year_created_equal_4_chars function might look: function make_year_created_equal_4_chars() { ?> <script type='text/javascript'> // This is a shorthand for "jQuery(document).ready()" jQuery(function($) { ...


0

Thank you for your answer, yes i don't have a good level in javascript but i have created the same thing that you said and its worked but its need the animation so i tried to be based on flex slider but without any success thats my code, i know that this code is for attachement but i don't have anything shown. function revconcept_get_images($post_id) { ...


0

I think the problem is you don't know how to use the slider plugins you choose. In fact if you know JavaScript, you could make a simple slider without jQuery. To create a post slider, the steps is: 1: Create a post list by WordPress function. Use a <ul> label to wrap the list and use <li> label wrap every post: <div ...


0

Finally, I found how to change the non-frame $button_labels of a WP_Customize_Image_Control by extending its class, not reassigning a new $type and implement an enqueue() function to enqueue a pure JavaScript code to manipulate the non-frame labels, like this to change the dynamic 'default' label by .addEventListener("click", handler) to its dynamic .button: ...


0

First you need to do what Dougal said about getting the ajax-url right. I would also specify the dataType. dataType is the type of data that you're expecting back from the server, you can read more about it here. And I would use wordpress's get_template_part to get the template.


1

when ("#edit").click( is called, the element "#edit" doesn't exist so the .click( cannot be attached solution 1 you call click( juste after .innerHTML = response solution 2 use delegated event like that : $("body").on("click", "#edit", function () {...


1

So, you're using wp_localize_script to inject the ajax url. But you didn't use the localized var handle to access that value. Try this: /* ... */ $.ajax({ url: ajaxStuff.ajaxurl, // NOTE use of 'ajaxStuff' object /* ... */


0

First off, jquery is most likely already enqueued by the main theme. But if not, the proper way is to call wp_enqueue_script('jquery') in a function for the action hook wp_enqueue_scripts. Example: function enqueue_jquery() { wp_enqueue_script('jquery'); } add_action('wp_enqueue_scripts', 'enqueue_jquery'). This code would need to be added to the ...


1

My problem got solved by commenting the some codes in function.js(theme js folder) that generating "Expand child menu" text.


2

From Blackbone.js website: render is the core function that your view should override, in order to populate its element (this.el), with the appropriate HTML. The convention is for render to always return this. So, I have modified the code a little bit to add jQuery change listener. function add_gallery_type_option(){ ?> <script ...


0

add a loop to display all taxonomy : if (2 > count($locations)) { echo '<strong>Location:</strong> '.$locations[0]->name.'<br>'; } else { echo "<strong>Location:</strong>"; echo "<ul>"; foreach ($locations as $l) { echo "<li>"; echo $l->name; echo "</li>"; ...


0

Use wp_enqueue_script() with $in_footer parameter set to true, when loading scripts with your shortcode. To pass data from the PHP part of your code to the JS part use wp_localize_script(). wp_enqueue_script( 'script_name', '/script-location/script.js', array(), '1.0.0', true ); $data_array = array( 'key_1' => 'val_1', 'key_2' => 'val_2' ); ...


2

You should always use a full URI when specifying a location of a resource (in this case a file). With relative URIs like you use for you data file here, the URI will be appended to the URL in the address bar which will result in surprising URLs when you use permalinks. In practice the pattern for developing such thing is to upload the files via the admin ...


1

Turns out it was the WooCommerce Jetpack Plugin all along. Stupid thing had something enabled which it didn't need. I guess that's what I get if I let a client access the plugin menu. Thank you, denis.stoyanov, for helping me find the solution!



Top 50 recent answers are included