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

12
votes
4answers
7k 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 ...
11
votes
5answers
14k views

How to correctly include jquery-ui effects on wordpress

I've been trying to include the jquery ui effects (more specifically the shake effect) on my wordpress theme. So far, I've only been able to include the jQuery script, but I really have no clue where ...
11
votes
2answers
9k 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 ...
10
votes
3answers
4k 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: ...
10
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, ...
10
votes
1answer
441 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 ...
9
votes
2answers
5k 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 ...
8
votes
5answers
5k 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 ...
8
votes
3answers
5k 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 ...
8
votes
1answer
3k 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 ...
7
votes
1answer
4k 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; ...
7
votes
3answers
181 views

How to modify image editor dialog options on WordPress?

I am trying to hide the Alignment radio buttons for images uploaded to the post content area, but can't figure out how to add a custom CSS or JS file to the Image Editor dialog. I've successfully ...
6
votes
2answers
4k 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 ...
6
votes
1answer
2k 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
2answers
758 views

Confirmation box when submitting post for review

A very common issue that I experience with new authors is that they forget to complete a few essential tasks prior to submitting their post for review (even though I have a guide available for them). ...
6
votes
2answers
5k views

Enable Submit Comment Without Page Reload (Using Ajax)?

When user writes a comment and hits the submit button, WordPress reloads the page, before the comment is shown to the user. Is there an Ajax-based solution that allows users to submit questions ...
6
votes
1answer
6k views

CSS not pulling in for jQuery UI dialog

I want to add a jQuery dialog modal to a form page. When the dialog box is triggered I see the the text content but with no CSS. I'm pulling in the jquery in the functions.php for the page: ...
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 ...
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: ...
5
votes
5answers
2k 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" ...
5
votes
2answers
871 views

Test to see if jQuery or Prototype is queued by another plugin?

In my plugin, I want to test to see if jQuery or Prototype (or both) are going to be loaded by another plugin. So, have wp_enqueue_script('jquery') or wp_enqueue_script('prototype') has already been ...
5
votes
2answers
1k 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 ...
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 ...
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 ...
5
votes
1answer
75 views

IP address character limit

my client in his template is using <?php comment_author_IP(); ?> to display IP's of comment authors. Recently he came to me with idea of limiting whole number to several characters. Final result ...
5
votes
1answer
199 views

Help making my pagination plugin better

I'm not sure if this is the right place to ask for this kind of help since is not an actual question but hopefully I can learn a thing or two. I'm developing a plugin (my first one) inspired in the ...
5
votes
2answers
393 views

Require featured image

I would like to require a featured image on a site I am developing. I tried the code here: Make featured image required and nothing happened - the JS showed up in the site header, but I could still ...
5
votes
2answers
3k views

Using the WordPress Media Library and returning the Attachment ID rather than URL?

I'm currently using some JS to pop open the WordPress Media Library in a thickbox container and return the URL of a selected image, then display it. window.send_to_editor = function(html) { ...
4
votes
2answers
103 views

Creating Ajax backend for Specialised Page Template? Should admin-ajax.php be used?

We're scoping an upcoming project that will require the development of a large php web application within an existing wordpress site - this is for our use only and we've no intention of trying to ...
4
votes
1answer
1k views

Make jQuery library load before plugin files

I am using a few jQuery plugins such as validate.js, but they all load BEFORE the Jquery library which is loaded automatically by WordPress and my theme. I need the plugins to load after - so is ...
4
votes
3answers
235 views

Best Practices for Seperating jQuery from HTML/PHP

I am creating several jQuery scripts to help validate forms before they are submitted. I have read that it is best to always separate jQuery scripts into a separate file so that you can load the ...
4
votes
5answers
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 ...
4
votes
1answer
739 views

Automatically decrease font size for long words

I am working on an e-commerce site in which post and product titles will need to be displayed in fairly narrow divs. I would like to set a specific font size for words which can naturally fit in the ...
4
votes
3answers
349 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 ...
4
votes
1answer
187 views

WordPress: Sortable Metabox Fields Not Saving Position

I've run into a problem that has got me stumped: after upgrading to WP 3.6 my sortable metabox fields are not saving their position when you re-order them. Below is my code: PHP: function save_box( ...
4
votes
1answer
112 views

Click link on plugin/theme page and open the contextual help on a specific tab

I've added a help section using the add_help_tab() function. I'd like to be able to click a link somewhere on the theme/plugin page and have the help panel open at whichever tab I need. Can someone ...
4
votes
1answer
370 views

How to Add jQuery Infinite Scroll to My Custom Archive Page

I currently have a custom archive page that displays my current post at the top and then links to all of my older posts below that. However, I need to break up the page so that it displays the ...
4
votes
2answers
3k views

Infinite scroll / lazy loading with NextGen Gallery

I'm working on a project for a friend that involves a massive page with 3,000+ photos. See: http://www.thepurplepixie.com/projects/purple-pixies-people-project/ Currently, I have pagination set to 50 ...
3
votes
3answers
3k views

How to handle multiple instance of “send_to_editor” js function

Here is what I am doing: I Added wordpress media upload with iframe popup when a button or link clicked. And with click of insert into post the image url placed on a textbox. send_to_editor() ...
3
votes
5answers
4k views

Wordpress and isotope filtering

Im trying to use Isotope(http://isotope.metafizzy.co/) to filter my Wordpress posts, http://i44.tinypic.com/fco55k.jpg this is how my site looks like, i would like to filter posts depending on a post ...
3
votes
3answers
817 views

jQuery UI in Admin (Best Practice?)

Maybe someone has prior experience with this, but when I include the jQuery UI 1.8.9 file within my admin_head I break the functionality of the dashboard (i.e. popup for adding featured image, drag ...
3
votes
2answers
6k views

Convert jQuery Datepicker Format to SQL Date Format

I set the jQuery Datepicker format to D d.m. displayed as Th 3.3. for a custom meta field that I want to use to sort posts. In SQL, the custom meta field is saved as D d.m. I would like to display ...
3
votes
2answers
2k views

Most efficient way to add javascript file to specific post and/or pages?

I am wondering what the most efficient method is to add a javascript file specifically for a post and/or page. Here are a few solutions I came up with: Switch to HTML editing view and post your ...
3
votes
3answers
2k 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 ...
3
votes
2answers
567 views

jQuery in header or footer

From my reading it seems there is a good case for loading scripts like jquery and dependencies into the footer as a preference if possible; however 2 things confuse me which. Firstly the default for ...
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
1answer
131 views

As a plugin developer, how to deal with theme developer loading jquery from google?

Theme developers like to deregister wordpress jquery and load jquery from google instead. I've been told it is for speed and I agree. This usually is not a problem for me since I always use jQuery ...
3
votes
2answers
469 views

Why do we include jQuery in the header?

I was told not to mess with the core files. Also, I don't want jQuery to load on every single page.
3
votes
2answers
2k views

Add a jQuery function to admin pages

I need to add a bit of document ready jQuery to post/page editors in admin. I'm hacking an old plugin that adds a text box to the editor page and handles inserting that text in a template file, but ...
3
votes
2answers
318 views

AJAX function returning -1

I recently developed a small plugin for my site, that uses AJAX, and now I am trying to implement the same AJAX techniques for the same site's templates, but I keep getting -1 as the result, here is ...