Is it possible to put a function somewhere other than the functions.php file? I.e directly into a template?
I have the following that needs to be called before some code and to make sure this happens I want to place it above everything else in the template:
function set_region_cookie()
{
if(isset($_POST['region']))
{
// Set Cookie
setcookie('region', $_POST['region'], time()+1209600);
// Reload the current page so that the cookie is sent with the request
header('Region: '.$_SERVER['REQUEST_URI']);
}
}
add_action('init', 'set_region_cookie');