Categories
Code jQuery WordPress

Fixing JSON Parse Error in WordPress Plugins

If you write WordPress plugins and make AJAX requests, you may be familiar the dreaded Javascript error: SyntaxError: JSON Parse Error: Unrecognized token ‘>’ Why? Why!?! What it means is that the response your code expected is screwed up because a plugin barfed PHP warnings into the admin-ajax.php ventilation system. When WP_DEBUG is on, admin-ajax.php […]

Categories
jQuery WordPress

Toggle WordPress Help Menu

It’s not possible (as far as I know) to currently link directly to a help tab in WordPress. Here’s the jQuery solution I cooked up: “ /** * Toggle the WP help menu tab by linking to the tab id * * The anchor must have a `rel` of `wp-help` */ $(‘a[rel=”wp-help”]’).click(function() { // Open […]

Categories
jQuery

jQuery validator annoyances

For all of you that use jQuery and use the Validator plugin, you may have been getting this error in Internet Explorer 6: jQuery.Validator is null or not an object This code will break any jQuery below your validation code, and will thoroughly piss you off. The fix is simple: use the minified version (jquery.validate.min.js) javascript […]

Categories
Code jQuery

Simple Vertical Align Plugin for jQuery

Sometimes you may want to vertically align a block item, but the CSS-only vertical aligning methods don’t make you feel clean.  Personally, I hate having to style items as a table/table cell to get them to vertically align in Internet Explorer. jQuery to the rescue.  Using a jQuery vertical align snippet as my base code, I modified it […]