A bare minimum example of leveraging the Iron Ajax plugin. Recommended locations for this code in order by my personal preference: mu-plugins file, a plugin, or the theme functions.php.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Modify the entries_count | |
* i.e. the number of entries that need | |
* to be processed | |
*/ | |
add_filter( | |
'fe_ajx_iron_ajax_entries_count', | |
'examp_iajx_entries_count' | |
); | |
function examp_iajx_entries_count( $count ) { | |
// generally you'll perform some lookup | |
// to determine the total number of entries | |
// $count = my_function_to_determine_count(); | |
return $count; | |
} | |
/* Process each entry | |
*/ | |
add_filter( | |
'fe_ajx_iron_ajax_process', | |
'examp_iajx_process', | |
10, 3 | |
); | |
function examp_iajx_process( $response, $index, $persist ) { | |
// add code here to process based on $index | |
// e.g. process the row at $index in a csv | |
// my_function_to_process_one_item( $index ); | |
return $response; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment