I'm starting a WordPress website where I need the template to do a few things differently depending on the "Custom Fields" I set for each Page. The easiest way for me to do this is to have php values of the custom fields I set on those pages that I can then use throughout template files.
The closest thing I have found in WP documentation is:
<?php $key = "Random_Key_I_Need_Here" echo get_post_meta($post->ID, '$key', true); ?>
This echos the value of the key I need, but what I need is that value in a PHP value instead, so that I can use it throughout the template to dictate certain tags/content. Basically, how do I get exactly what the above script is doing in a PHP value instead of echo'ing it?
Thanks