File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1414 * @package ALM_SearchWP
1515 */
1616
17+ if ( ! defined ( 'ABSPATH ' ) ) {
18+ exit ;
19+ }
20+
21+ /**
22+ * Installation hook.
23+ */
24+ function alm_searchwp_install () {
25+ if ( ! is_plugin_active ( 'ajax-load-more/ajax-load-more.php ' ) ) {
26+ set_transient ( 'alm_searchwp_admin_notice ' , true , 5 );
27+ }
28+ }
29+ register_activation_hook ( __FILE__ , 'alm_searchwp_install ' );
30+
31+ /**
32+ * Display admin notice if plugin does not meet the requirements.
33+ */
34+ function alm_searchwp_admin_notice () {
35+ $ slug = 'ajax-load-more ' ;
36+ $ plugin = $ slug . '-for-searchwp ' ;
37+ // Ajax Load More Notice.
38+ if ( get_transient ( 'alm_searchwp_admin_notice ' ) ) {
39+ $ install_url = get_admin_url () . '/update.php?action=install-plugin&plugin= ' . $ slug . '&_wpnonce= ' . wp_create_nonce ( 'install-plugin_ ' . $ slug );
40+ $ message = '<div class="error"> ' ;
41+ $ message .= '<p>You must install and activate the core Ajax Load More plugin before using the Ajax Load More SearchWP extension.</p> ' ;
42+ $ message .= '<p> ' . sprintf ( '<a href="%s" class="button-primary">%s</a> ' , $ install_url , 'Install Ajax Load More Now ' ) . '</p> ' ;
43+ $ message .= '</div> ' ;
44+ echo wp_kses_post ( $ message );
45+ delete_transient ( 'alm_searchwp_admin_notice ' );
46+ }
47+ }
48+ add_action ( 'admin_notices ' , 'alm_searchwp_admin_notice ' );
49+
1750if ( ! class_exists ( 'ALM_SearchWP ' ) ) :
1851
1952 /**
You can’t perform that action at this time.
0 commit comments