You could put files in wordpress/wp-content/themes
and then include them from various themes. You could even make a folder named wordpress/wp-content/themes/global-includes
or shared
.
For me, including a file from the parent directory I couldn't just do:
<?php include_once "../globalform.php"; ?>
Instead I needed to do:
<?php include_once get_template_directory() . "/../globalform.php"; ?>
You could also use get_stylesheet_directory()
(gets child theme directory) instead of get_template_directory()
(will get parent theme directory if the current theme is a child theme. Since we're getting the parent directory it probably doesn't matter here.