I have created a new tab under the new media upload whose content is created by:
$folder_id = $_GET['folder_id'];
global $wpdb;
$foldertable = $wpdb->prefix . 'icrm_folders';
if (!$folder_id) {
$sql = $wpdb->prepare( "SELECT * FROM {$foldertable} WHERE folder_id IS NULL" );
} else {
$sql = $wpdb->prepare( "SELECT * FROM {$foldertable} WHERE folder_id = %d", $folder_id );
}
$folders = $wpdb->get_results( $sql, ARRAY_A );
echo '<div id="media-items">';
foreach ( $folders as $folder ) {
echo '<a href="#"><div class="media-item icrm-folder" id="folder-' . $folder['id'] . '" data-id="' . $folder['id'] . '">' . $folder['name'] . '</div></a>';
}
echo '</div>';
The goal here is to allow the user to navigate the media in a folder like structure (and other things not relevant here). Since the content loads based on the $_GET URL how do I let the user click on a folder and see its content?
I tried using ajax to reload the content and passing the variable but its not working, I think there is something wrong with my path but I can’t tell.
I also tried to add it directly to the link but using <a href="?folder_id="' . $folder['id'] . '">
But that just made the entire modal reload…..
There isn’t very good documentation on 3.5 so I’m struggling on where to even look. If someone could point me in the right direction, I would quite appreciate it. Thanks!