I have effectively produced my publish meta boxes, saved the information and that i learn how to retrieve the information. Inside the custom meta boxes I've got a area for that page branding which will decide what color plan per the merchandise line we're featuring on that page.

I've got a class per the colour plan that's triggered once the body includes a class from the products title appended into it. For instance:

<body class="product-drinks">

OR

<body class="product-abcwidgets">

Based on what products is chosen within the meta box for your publish determines what style sheet is going to be incorporated.

For instance basically chose "product-drinks" then your stylesheet incorporated could be product-drinks.css.

The majority of the meta box data I have to used in the loop however i should also access the page branding mega area data outdoors from the loop. Wouldso would I grab this data basically require it outdoors from the loop?

I initially considered placing a few of the data in a wide array while informed as a result after which referencing the $page_options array value in your body tag as a result:

(outdoors from the loop within the header)

<body class="<?php echo $page_options['pageBranding'];?>

from inside the loop"

$page_options = array(  

        'pageBranding'  =>  get_post_meta($post_id, 'pageBranding', true), 
        'layout'        =>  get_post_meta($post_id, 'pageLayout', true)
);

Shall We Be Held carrying this out properly or it is possible to better method of carrying this out? Or must i only reference the meta fields I want inside the loop after which use global $wordpress_query outdoors from the loop and obtain the publish meta this way for that data I demand for body and stylesheets?