global when doing have_posts inside function?
-
I need to access some custom field info before doing get_header() in my various templates (e.g., home.php, page.php, archive.php, etc.), so I’ve set up the following in functions.php:
function F_custom_fields() { if (have_posts()) : while (have_posts()) : the_post(); $custom_fields = get_post_custom(); $page_icon = $custom_fields['eva_page_icon'][0]; $div_id = $custom_fields['eva_div_id'][0]; endwhile; endif; }
Since this is not working, I figure there is a variable/array/other that I need to set with global $var as the first thing in the function. I just can’t figure out what it is.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘global when doing have_posts inside function?’ is closed to new replies.