Pass a PHP variable to another file

Question

Is there a simple method to passing data from one file to another? I’m new to PHP and can’t find a simple answer to my problem online. Apologies if this has been answered a million times & thanks in advance.

My Template 

<?php

// Declare a variable with the name of the file I want to pull in 
$critical_css = 'style';

// Header
get_header();

?>
Header 

// Get php file with inline style written inside
<?php get_template_part('/path/to/' . $critical_css); ?> 
0
, Evan Meredith-Davies 2 years 2019-11-27T03:56:44-05:00 0 Answers 81 views 0

Leave an answer

Browse
Browse