I have created custom divi module and then convert it to the plugin. Now I want to active plugin only if Divi theme is activated. when i write code like this way it shows notice everytime.
function my_admin_notice(){
echo '<div class="updated">
<p>test Admin notice.</p>
</div>';
}
add_action('admin_notices', 'my_admin_notice');
But when I write code with conditions based
function angelleye_setup_For_paypal_divi_install()
{
if (function_exists('et_setup_theme')) {
// Divi is the current theme or the active theme's parent.
// trigger our function that registers PayPal for Divi plugin.
angelleye_setup_for_paypal_divi();
}
else{
// code when theme is not activated.
add_action('admin_notices', 'my_admin_notice');
}
}
register_activation_hook( __FILE__, 'angelleye_setup_For_paypal_divi_install' );
function my_admin_notice(){
echo '<div class="updated">
<p>test Admin notice.</p>
</div>';
}
I copied code for showing admin notice here https://wptheming.com/2011/08/admin-notices-in-wordpress/
Now add_action I am calling in function angelleye_setup_For_paypal_divi_install But in the function add_action is not working,.
add_actionis working but there is a problem within thatadd_action function. Tryecho Hello World;before implementing logic within the function. If you see hello world then the add_action is working but there is a problem with the logic you are implementing - Fahad Sohail