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

Usage examples

1
/**
2
* Example 1
3
*
4
* This function will save the search phrase to the database
5
*/
6
add_action( 'asp_before_search', 'asp_change_phrase', 10, 1);
7
8
function asp_change_phrase( $phrase ) {
9
update_option('asp_search_phrase', $phrase);
10
}
11
12
/**
13
* Example 2
14
*
15
* This function will print "Hi!" header before the search shortcode.
16
*/
17
add_action( 'asp_layout_before_shortcode', 'asp_print_before_shortcode');
18
19
function asp_print_before_shortcode() {
20
echo "<h3>Hi!</h3>";
21
}
Copied!
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

1
/**
2
* Functional actions
3
*
4
* Variables:
5
* $id -> the ID of the search instance
6
* $search_phrase -> holds the search phrase
7
* $results_assoc_array -> an associated array of all result objects
8
* $pageposts_assoc_array -> an associated array of posts, pages, custom post types results
9
* $commentsresults_assoc_array -> an associated array of comment results
10
* $buddypresults_assoc_array -> an associated array of buddypress results
11
*/
12
13
do_action('asp_before_search', $search_phrase);
14
do_action('asp_after_search', $search_phrase, $results_assoc_array);
15
16
do_action('asp_after_pagepost_results', $search_phrase, $pageposts_assoc_array);
17
do_action('asp_after_comments_results', $search_phrase, $commentsresults_assoc_array);
18
do_action('asp_after_buddypress_results', $search_phrase, $buddypresults_assoc_array);
19
20
do_action('asp_before_autocomplete', $search_phrase);
21
do_action('asp_after_autocomplete', $search_phrase, $keyword);
22
23
/* Box, Settings etc.. layount actions */
24
25
do_action('asp_layout_before_shortcode', $id);
26
do_action('asp_layout_after_shortcode', $id);
27
do_action('asp_layout_before_input', $id);
28
do_action('asp_layout_after_input', $id);
29
do_action('asp_layout_before_magnifier', $id);
30
do_action('asp_layout_in_magnifier', $id);
31
do_action('asp_layout_after_magnifier', $id);
32
do_action('asp_layout_before_settings', $id);
33
do_action('asp_layout_after_settings', $id);
34
do_action('asp_layout_before_loading', $id);
35
do_action('asp_layout_in_loading', $id);
36
do_action('asp_layout_after_loading', $id);
37
do_action('asp_layout_settings_before_first_item', $id);
38
39
/* Template related actions */
40
41
// Vertical layout
42
do_action('asp_res_vertical_begin_item');
43
do_action('asp_res_vertical_before_image');
44
do_action('asp_res_vertical_after_image');
45
do_action('asp_res_vertical_after_content');
46
do_action('asp_res_vertical_end_item');
47
48
// Horizontal layout
49
do_action('asp_res_horizontal_begin_item');
50
do_action('asp_res_horizontal_after_image');
51
do_action('asp_res_horizontal_after_content');
52
do_action('asp_res_horizontal_end_item');
53
54
// Isotopic layout
55
do_action('asp_res_isotopic_begin_item');
56
do_action('asp_res_isotopic_after_image');
57
do_action('asp_res_isotopic_after_content');
58
do_action('asp_res_isotopic_end_item');
Copied!