I'm building a Wordpress plugin and as per the plugin functionality requirement I need to find out if a Wordpress theme has a particular hook or not and in case if it doesn't have then I need to perform some action. Say for eg. show an alert message.
The WordPress function has_action is used for this purpose.
Here's a really basic example showing how you can echo a message if the theme doesn't have the hook you need:
if(has_action('example_hook')) {
do_action('example_hook');
} else {
echo 'an example alert message';
}