Monthly Archives: July 2012

How I fixed: “Uncaught TypeError: Object [object Object] has no method tablesorter”

/Camp — Free classes on all things Web in the Scottsdale, Arizona area (Ad)


Trying to get this Tablesorter plugin to work I did the following to fix it:

Okay, so this is what I did to fix this. First, I noticed that the plugin extends the $ functions, so I had to make sure and use (right way)

$(document).ready(function() { 
    $('#report').tablesorter(); 
});

Before, I was using this because I was using WordPress (wrong way)

jQuery(document).ready(function() { 
    jQuery('#report').tablesorter(); 
});

Then, I had to make sure that in they weren’t <td>‘s, but were <th>‘s

<table class="tablesorter" id="report">
        <thead>
            <tr class="head">
                <th class="id">ID</th>
                <?php foreach($definitions['report_fields'] as $field_key): ?>
                    <th>
                        <?php webfoots_e($definitions['fields'][$field_key]['label']); ?>
                    </th>
                <?php endforeach; ?>
            </tr>
        </thead>

Hope it helps!

Over @Stackoverflow

How to Automatically Insert Into Post when uploading Media in WordPress

This is how I did it:

First, in your plugin, force the basic uploader. If you want the flash uploader, sorry.

add_filter( 'flash_uploader', '_force_html_uploader' );

function _force_html_uploader( $flash ) {
    remove_action('post-html-upload-ui', 'media_upload_html_bypass' );
    return false;
}

Then tell WP to put a JavaScript in the Media Uploader’s <head>:

add_action('media_upload_tabs', '_media_upload_auto_insert_js');

function _media_upload_auto_insert_js(){
    ?>?php%20bloginfo('stylesheet_directory');%20?/js/upload.js<?php
}

Then, in that JavaScript file, when the page is loaded with the button to Insert Into Post, click it for them!

uploads.js

jQuery(document).ready(function(){
    if(jQuery(".savesend input")){
        jQuery(".savesend input").click();
    }
});