I am working on a WordPress website. I was wondering how can I share some PHP variables which are needed in multiple different files without the need to copy-paste the same variables over and over again.
I have some taxonomy variables which I need to use in different files.
This is from my single.php file:
$taxonomy_themes = wp_get_post_terms(get_the_ID(), 'themas');
$taxonomy_rubrieken = wp_get_post_terms(get_the_ID(), 'rubrieken');
$taxonomy_themes_singular_name = $taxonomy_themes[0]->name;
$taxonomy_rubrieken_singular_name = $taxonomy_rubrieken[0]->name;
$taxonomy_themes_singular_slug = $taxonomy_themes[0]->slug;
$taxonomy_rubrieken_singular_slug = $taxonomy_rubrieken[0]->slug;
$taxonomy_themes_singular_link = get_term_link($taxonomy_themes_singular_slug, 'themas');
$taxonomy_rubrieken_singular_link = get_term_link($taxonomy_rubrieken_singular_slug, 'rubrieken');
How can I share these files globally with other files and use them?