Trigger popup in a php if/else statement
You are creating a cookie_checker function that returns the shortcode. However, the action you are hooking into (init), is executed too early (before the page content is created). You could instead try to “echo” the shortcode content in the footer of the page by hooking to wp_print_footer_scripts. An example I haven’t tested, but should work: … Read more