jQuery is a fast and concise JavaScript Library that simplifies HTML document traversing, event handling, animating, and Ajax interactions for rapid web development. jQuery is included with WordPress, and available to both themes and plugin developers.

learn more… | top users | synonyms

11
votes
3answers
5k views

$ not defined using jQuery in Wordpress

I know that jQuery is loaded, because I can switch out the $ for 'jQuery' and everything behaves as expected, but this will be a messy script if I can't fix this This script: ...
7
votes
2answers
6k views

Display Media Uploader in Own Plugin on Wordpress 3.5

I have little problem with Media Uploader in new WordPress 3.5. I created own plugin which is upload the picture. I'm using this code JS: <script type="text/javascript"> var file_frame; ...
6
votes
2answers
3k views

How Do I Use jQuery UI In My Plugin

It's a sad day in the world when I Google something and it returns nothing. I am trying to use the default datepicker (or ANY datepicker at this point) and am unable to because of my lack of ...
10
votes
1answer
4k views

How to manage ajax calls and JSON in wordpress

I have a custom post type that i want to access through jQuery - preferably using JSON. So first things first. creating a function that returns/echos json is easy enough, but how would I access it ...
3
votes
3answers
3k views

Adding jquery and thickbox to WordPress theme

I would like to add thickbox for the template which I develop to WordPress. At this time I'm trying with a clean template that have only header.php, footer.php,index.php, and functions.php. I've ...
12
votes
2answers
12k views

How to save the state of a drag and drop jQuery UI Sortables front end layout editor?

I am building a front end post layout editor using jQuery UI Sortable. The posts are laid out in 300px by 250px boxes over a background image. The posts are created and edited using the WordPress ...
-1
votes
1answer
160 views

WordPress and jQuery [closed]

I am fairly new to using jQuery in WordPress and I am trying to write jQuery scripts in a separate file. What is the difference between the following two syntaxes of setting up the external file: ...
7
votes
1answer
3k views

How can I fetch loop of post titles via AJAX?

I have a list of the most recent post titles in sidebar.php. Here is an example of how that code looks: <?php $args = array('posts_per_page' => 20); ?> <?php $sidebar = new ...
6
votes
5answers
3k views

Wordpress 3.5 Media Manager - add a button

In my plugin, I would like to add two buttons to Media Manager (to the left of "Insert Into Post" in "media-toolbar-primary" section), and connect a jQuery action to it. First one - The "Select All" ...
9
votes
2answers
7k views

How to Link External jQuery/Javascript files with WordPress

So I'm using Starkers to base my next WP theme on and I've run into a small issue, I was including my own version of jQuery in the header.php file but when inspecting my site using Firebug I noticed ...
1
vote
2answers
1k views

How to trap “Publish” button to check for meta box validation?

I'm trying to do some form validation on my custom meta box, and I remember somewhere reading about some javascript function to disable/enable the Publish button - except I can't find it. How do I ...
10
votes
1answer
576 views

Using jQuery to delete data stored in wp_options

I wonder if anyone could advise me further on my problem. Part of my plugin stores log files for debugging purposes. I have successfully displayed them in a (div#log) in my admin page using jquery ...
0
votes
1answer
279 views

Update Wordpress Custom Field with AJAX on cached page

I'm new to ajax am trying to create a simple hit counter that updates a custom field in Wordpress after the page loads. The page is cached, so any attempts to use PHP alone will not work. I'd like ...
8
votes
3answers
7k views

Validating Custom Meta Box Values & Required Fields

Something which I have never seen covered is the best way to validate that specific form fields are filled out correctly for custom post type meta boxes. I am looking to get expert opinions on how ...
9
votes
5answers
6k views

Including jQuery and JavaScript files the correct way

I'm having some trouble with this. I'm not sure how to do it the correct way, and I read so many different techniques and ways to do it that I don't know what to make of it. Some questions and ...
11
votes
2answers
1k views

pass object/JSON to wp_localize_script

I've got a working piece of javascript that contains an object literal. But I need to localize it, and I'm ytrying to figure out how to rewrite it so that I can get wp_localize_script() to accet it, ...
3
votes
2answers
2k views

Pass PHP variable to javascript

Is there any possibility to pass some PHP variables in javascript so I can use them later? Only in single.php. I heard about wp_enqueue_scripts but with that it is neccesary to declare a path to a JS ...
4
votes
3answers
435 views

Handling jQuery Component Collision

In plugin development, what is the best practice to prevent jQuery component collision on the front end? For instance, let's say I include the jQuery Apprise dialog in a plugin that loads this on the ...
0
votes
1answer
536 views

Any good lightbox-like option that works in WP 3.2.1?

I'm having problems finding a "plugin" that will help me display some of my images in a nice way such as prettyPhoto, Lightbox etc. As I'm already using the jQuery library, I'd prefer a plugin that ...
0
votes
1answer
965 views

Getting an alphabetic post list with two letters onclick on letter

I have a website in Wordpress and a page with a list with letters like this: A B C D E F G H I ... This shows me all posts with the letter A for instance. That's nice, but I want it to make it ...
0
votes
1answer
269 views

Comment form vaildation

I've build a custom comments form which hooks onto the default comment_form() in twenty twelve child theme. Here is my code functions.php function pietergoosen_custom_comment_fields($fields) { ...
0
votes
1answer
132 views

Passing a varible from jQuery to PHP

I have a a bunch of li's that are a blog but i want to show them enlarged in a colorbox. Therefore I need to know which li I clicked so I can get that ID and use that in my query to get all the date ...
12
votes
4answers
9k views

Using Wordpress 3.5 Media Uploader in meta box?

Is this possible to do? I love how the new uploader works. I'm guessing it has to do with a jQuery call like the other way did. EDIT This is the code I am currently using ...
6
votes
3answers
3k views

wordpress json custom taxonomy problem

I created 1 custom post type with 2 custom taxonomy. Installed http://wordpress.org/extend/plugins/json-api/ and tried to reach result with: ...
3
votes
1answer
4k views

How to make ajax call in wordpress in right way?

I am trying to using jquery ui tabs with ajax calls to run a function. Here is the code i am using: function ajax_load_user_feed(){ if(isset($_GET['type'])) $type = $_GET['type']; ...
3
votes
3answers
11k views

How to add a javascript snippet to the footer that requires jQuery

I know I can add a script file to the footer of wordpress that requires jquery using this code: <?php function my_scripts_method() { // register your script location, dependencies and version ...
2
votes
4answers
3k views

Asynchronous Javascript Loaders

I'd like to take advantage of loading my scripts while the page is loading. ie. Yepnope, head.js etc... But I also want to be able to enqueue the script so other plugins don't try adding their own. ...
0
votes
1answer
1k views

ajax jquery update custom field meta value front end

There is probably a much easier way to do this. After much trial and error trying to get a postid from a url, I've opted to add the id to the permalink. However I have no idea how the custom value ...
6
votes
2answers
5k views

How to dequeue a script?

Wordpress has wp_enqueue_script() but not a wp_dequeue_script() function, so what would be the best way to dequeue a script? I'm using LAB.js to load all of my scripts rather than enqueueing them ...
4
votes
1answer
279 views

Concatenate and minify dependencies for enqueued JavaScript files

I'm loading a JavaScript file using wp_enqueue_script into my theme. However, along with it, I'm loading several jQuery files as well, as dependencies for the enqueued script (which has already been ...
2
votes
2answers
128 views

$wp_customize customizer_preview_init not firing inside javascript

I'm trying hook the customizer_preview_init action in order to trigger live preview of the changes I'm making in the customizer. However, my first test is failing. I'm just trying to get an alert to ...
1
vote
1answer
1k views

Adding Colorpicker Field To Category

I want to add a custom field to my categories where the user can color code them. I've added the field but I want to use built in colorpicker (either tinyMCE or the farbtastic) to give the user an ...
0
votes
1answer
3k views

How to save Uploaded image in custom option panel?

I'm trying to add a custom option panel to a new template following a tutorial found on NetTuts. I saved all the code for the option panel inside a file called optionpanel.php (LoL) and everything is ...
-1
votes
2answers
1k views

Integrating WordPress Content into a jQuery Slider

I have a pretty basic 'featured-list - image slider' implemented above my content in my custom WordPress theme. How do I integrate WordPress content into the slider so that the slide content is pulled ...
2
votes
1answer
1k views

jQuery plugin function is not a function

I'm having a problem I've never seen before. In a very new WordPress install, I uploaded a theme I had been working on for a friend's restaurant: CornerPocketPub.com The problem, as you can see, is ...
1
vote
2answers
901 views

Why Won't my jQuery Play Nice with Wordpress?

Code in question here: http://pastebin.com/PN29WKNq It worked on the HTML page I tested it on. Its supposed to add "display: none" to the content divs and then add "display: block" when the ...
0
votes
2answers
131 views

Manipulate retrieved ajax data in php

I made a basic ajax request to 2 variables. I want the values to be sent and manipulated in the back-end in order to use them in a database query. All that should happen on page load. My main.js code: ...
0
votes
1answer
170 views

jQuery AJAX call not executing in Plugin

I've been working on a class for my free plugins that outputs a "Donate" form. The "No thanks" dismissal link hides the form and runs an AJAX call to update a WP Option keeping track of the ...
0
votes
2answers
2k views

Javascript included but alert() function not working

I've included the javascript by wp_enqueue_script('slider', plugins_url( 'slider.js', __FILE__ ) ); with just a simple $(document).ready(function () { alert("alert"); }); It shows up in the ...
0
votes
1answer
1k views

Trying to get fittext to work in Wordpress

I have the following code in my template page and I have registered jquery and fittext in my theme's functions.php. They are currently showing up in the footer as I set them to. I can set them up in ...
0
votes
1answer
192 views

Using jQuery .after inside loop

I have a bit of javascript that will dynamically add a static post to a loop. The script uses the jQuery 'after' method and on a static page it works beautifully but when inside the loop I don't get ...
5
votes
2answers
2k views

Add custom shortcode button to Editor

Before the new version of Wordpress 3.0 came out I was using this jQuery code below to add custom buttons for my own shortcodes to the editor toolbar in the admin panel, it worked great. However with ...
4
votes
4answers
3k views

What is a good jQuery content slider plugin? [closed]

I'm looking for a plugin that will let me easily place a jQuery based (because I want to avoid the hassle of multiple javascript libraries) slider on my site in various places. I'd like it to be able ...
3
votes
1answer
1k views

Custom function to rearrange attachments when creating posts – Almost there

I'm having some trouble with a custom thing I'm doing. I've implented a custom image uploader into a metabox in a custom post type. Now I'm trying to work out a way that will let me reorder the ...
3
votes
4answers
2k views

limit selection of custom taxonomies to one?

I have a site with CPT (short for custom post type) "bagp_deals" and custom taxonomies "ba_locations" and "ba_cats" basically Its post type of "Deals" with "Location" and "Categories" as hierarchical ...
2
votes
2answers
1k views

Wordpress Enqueue Script Chaos (jQuery & Foundation.js)

I've been working on building a theme for the past couple days now, and I've run into a wall. While I originally included foundation.js as an enqueued script, I couldn't remember why I had added it. ...
1
vote
3answers
636 views

WordPress Featured Post Slider

Alright, I have almost finished up a clients project in WordPress, but I have hit a wall. I am not really great with jQuery (and I have yet to find a plugin to achieve what they are looking for). The ...
6
votes
2answers
4k views

What is the simplest ajax upload plugin or script to be used with wordpress?

I'm trying to use image upload in my theme's options page and haven't found yet a simple ajax upload script with many tutorials or a good documentation, I just want a simple straightforward script so ...
5
votes
2answers
2k views

Making $ globally accessible with jQuery.noConflict()

The Codex promotes this method of using $ inside a plugin/theme JavaScript file: jQuery(document).ready(function($) { // $() will work as an alias for jQuery() inside of this function }); But ...
2
votes
2answers
3k views

How do I “unhook” / de-register jQuery so that it's not called as part of wp_footer();?

I need to "unhook" jQuery from my wp_footer() ... it's being called automatically and I'm looking for something I can add to functions.php which prevents it from being called a second time in the ...