I used some javascript code to pop up the message, and placed it in my “Simple GDPR’ plugin https://wordpress.org/plugins/simple-gdpr/ .
I got the javascript code from https://cookieconsent.insites.com/ , which details how to do it.
I used the ‘after_header’ action , as in
add_action('after_header', 'my_gdpr_notice');
to display the notice, plus using the ‘enqueue_scripts
‘ functions to add the javascript code and the associated CSS for the message.