Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I am using word press theme option panel and using those in my header.php without any issues, code as follows...

<?php
    // loading theme options.  used in header.php
    global $options;
    foreach ($options as $value) {
        if (get_settings( $value['id'] ) === FALSE) { 
            $$value['id'] = $value['std']; 
        } else { 
            $$value['id'] = get_settings( $value['id'] ); 
        }
    }
?>

<?php echo $aagt_fb_url; ?> //loads fb url

But if i use <?php echo $aagt_fb_url; ?> in index.php it doesn't work, can you please help me to resolve this issue. thanks.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

If you are using some custom global theme options, I’d set them in functions.php. Then you access them from any template if you declare them global first.

// functions.php
<?php
$aagt_fb_url = 'foo';

-

// template file like header.php, index.php, etc.
<?php
global $aagt_fb_url;
echo $aagt_fb_url;
share|improve this answer
    
thanks, if i paste options functions to retrieve values in functions.php, it doesn't work after using global $aagt_fb_url; echo $aagt_fb_url; –  seoppc Jun 13 '12 at 9:39
    
using <?php include('options.php'); ?> at every template file solves my problem. –  seoppc Jun 13 '12 at 9:58
    
Okay, to avoid having to include that file in every template maybe you could make $GLOBALS work for you? –  Geert Jun 13 '12 at 10:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.