Ajax, Permalinks and post_thumbnail

Rather than me solve your problem may I suggest you consider using the more WordPress standard method of AJAX? WordPress Codex: AJAX WordPress Codex: AJAX in Plugins How to manage ajax calls and JSON in WordPress How to Implement Ajax in WordPress Themes If you have follow up questions let us know.

Dashboard – get status and position of metaboxes and pass them to ajax method

You can hook into the sortstop event of the sortable metaboxes, and read the current state: jQuery( function( $ ) { $( ‘.meta-box-sortables’ ).bind( ‘sortstop’, function( event, ui ) { var sortData = {}; $(‘.meta-box-sortables’).each( function() { sortData[this.id.split(‘-‘)[0]] = $(this).sortable( ‘toArray’ ); } ); console.log( sortData ); } ); } ); You can also hook … Read more

Get post and all posts after it by ID?

I think you’re on the right path with posts_where, something like this should work: <?php function my_filter_where($where){ global $my_current_id; $where .= ” AND ID >= “.$my_current_id; return $where; } // random number I chose for sake of example $my_current_id = 30; add_filter(‘posts_where’, ‘my_filter_where’); $my_posts = new WP_Query(“posts_per_page=5&orderby=ID&order=ASC”); remove_filter(‘posts_where’, ‘my_filter_where’);

Control attachments menu order with jQuery Sortable

To save the menu order use wp_update_post() with each attachment ID and its new menu position: $thisattachment = array(); $thisattachment[‘ID’] = $thisid; $thisattachment[‘menu_order’] = $new_menu_position; wp_update_post($thisattachment); EDIT – assuming these are already attachments and you’re updating them? Otherwise you have to insert the attachments first with wp_insert_attachment

Using ajax with paging and a custom sub-query

Two options- load a page fragment using jQuery’s load method (see Loading Page Fragments), or create your own ajax function to load posts and return it in whatever markup you wish: add_action(‘wp_ajax_my_ajax_get_posts’, ‘my_ajax_callback’); add_action(‘wp_ajax_nopriv_my_ajax_get_posts’, ‘my_ajax_callback’); function my_ajax_callback() { $args = $_POST[‘myargs’]; $collected_child_posts = new WP_Query($args); echo ‘some stuff’; die(); } pass the admin-ajax url to … Read more