Actions list and usage

Actions are triggered by specific events that take place in the plugin code.

Usage examples

/**
 * Example 1
 *
 * This function will save the search phrase to the database
 */
add_action( 'asp_before_search', 'asp_change_phrase', 10, 1);

function asp_change_phrase( $phrase ) {
  update_option('asp_search_phrase', $phrase);
}

/**
 * Example 2
 * 
 * This function will print "Hi!" header before the search shortcode. 
 */
add_action( 'asp_layout_before_shortcode', 'asp_print_before_shortcode');

function asp_print_before_shortcode() {
  echo "<h3>Hi!</h3>";
}

More examples in the knowledge base.

If you need more general information about hooks in WordPress, please check their plugin API reference.

Action hook list

/**
 * Functional actions 
 * 
 * Variables:
 *      $id -> the ID of the search instance
 *      $search_phrase -> holds the search phrase
 *      $results_assoc_array -> an associated array of all result objects
 *      $pageposts_assoc_array -> an associated array of posts, pages, custom post types results
 *      $commentsresults_assoc_array -> an associated array of comment results
 *      $buddypresults_assoc_array -> an associated array of buddypress results
 */

do_action('asp_before_search', $search_phrase); 
do_action('asp_after_search', $search_phrase, $results_assoc_array);

do_action('asp_after_pagepost_results', $search_phrase, $pageposts_assoc_array);
do_action('asp_after_comments_results', $search_phrase, $commentsresults_assoc_array);
do_action('asp_after_buddypress_results', $search_phrase, $buddypresults_assoc_array);

do_action('asp_before_autocomplete', $search_phrase);
do_action('asp_after_autocomplete', $search_phrase, $keyword);

/* Box, Settings etc.. layount actions */

do_action('asp_layout_before_shortcode', $id);
do_action('asp_layout_after_shortcode', $id);
do_action('asp_layout_before_input', $id);
do_action('asp_layout_after_input', $id);
do_action('asp_layout_before_magnifier', $id);
do_action('asp_layout_in_magnifier', $id);
do_action('asp_layout_after_magnifier', $id);
do_action('asp_layout_before_settings', $id);
do_action('asp_layout_after_settings', $id);
do_action('asp_layout_before_loading', $id);
do_action('asp_layout_in_loading', $id);
do_action('asp_layout_after_loading', $id);
do_action('asp_layout_settings_before_first_item', $id);

/* Template related actions */

// Vertical layout
do_action('asp_res_vertical_begin_item');
do_action('asp_res_vertical_before_image');
do_action('asp_res_vertical_after_image');
do_action('asp_res_vertical_after_content');
do_action('asp_res_vertical_end_item');

// Horizontal layout
do_action('asp_res_horizontal_begin_item');
do_action('asp_res_horizontal_after_image');
do_action('asp_res_horizontal_after_content');
do_action('asp_res_horizontal_end_item');

// Isotopic layout
do_action('asp_res_isotopic_begin_item');
do_action('asp_res_isotopic_after_image');
do_action('asp_res_isotopic_after_content');
do_action('asp_res_isotopic_end_item');

Last updated