最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

Options Framework options not being output

programmeradmin1浏览0评论

I am using the Options Framework.

In my theme's options.php, I have the following code:

    function optionsframework_options() {
    
        $options = array();
            
        $options[] = array(
            'name' => __('Footer Navigation', 'options_framework_theme'),
            'type' => 'heading');
    
        $options[] = array(
            'name' => __('Button 1 URL', 'options_framework_theme'),
            'desc' => __('Enter the URL clicking on the button takes you to.', 'options_framework_theme'),
            'id' => 'footer-nav1_URL',
            'std' => '',
            'type' => 'text');
            
        $options[] = array(
            'name' => __('Button 1 Text', 'options_framework_theme'),
            'desc' => __('Enter the text you see underneath the button.', 'options_framework_theme'),
            'id' => 'footer-nav1_text',
            'std' => '',
            'type' => 'text');

In my theme's footer.php, I have the following code:

<?php if (of_get_option('footer-nav1_URL', '') !== '') { ?>
        <a href="<?php echo of_get_option('footer-nav1_URL', '');?>">
            <span id="icon1" class="index2"></span>
            <span class="iconshadow index1"></span>
            <span class="name"><?php echo of_get_option('footer-nav1_text', '');?></span>
        </a>
<?php 
}?>

Those options are not being output in the footer. The footer is working normally otherwise.

Other options called in front-page.php are working okay though.

Why won't these options work?

I am using the Options Framework.

In my theme's options.php, I have the following code:

    function optionsframework_options() {
    
        $options = array();
            
        $options[] = array(
            'name' => __('Footer Navigation', 'options_framework_theme'),
            'type' => 'heading');
    
        $options[] = array(
            'name' => __('Button 1 URL', 'options_framework_theme'),
            'desc' => __('Enter the URL clicking on the button takes you to.', 'options_framework_theme'),
            'id' => 'footer-nav1_URL',
            'std' => '',
            'type' => 'text');
            
        $options[] = array(
            'name' => __('Button 1 Text', 'options_framework_theme'),
            'desc' => __('Enter the text you see underneath the button.', 'options_framework_theme'),
            'id' => 'footer-nav1_text',
            'std' => '',
            'type' => 'text');

In my theme's footer.php, I have the following code:

<?php if (of_get_option('footer-nav1_URL', '') !== '') { ?>
        <a href="<?php echo of_get_option('footer-nav1_URL', '');?>">
            <span id="icon1" class="index2"></span>
            <span class="iconshadow index1"></span>
            <span class="name"><?php echo of_get_option('footer-nav1_text', '');?></span>
        </a>
<?php 
}?>

Those options are not being output in the footer. The footer is working normally otherwise.

Other options called in front-page.php are working okay though.

Why won't these options work?

Share Improve this question edited Oct 16, 2020 at 8:31 Lenin 1902 silver badges14 bronze badges asked Jan 4, 2014 at 6:09 SteveSteve 1,75719 gold badges66 silver badges115 bronze badges
Add a comment  | 

1 Answer 1

Reset to default 5 +50

I think the problem is that you are using uppercase letters in the options id:

footer-nav1_URL

Try instead:

footer-nav1_url

In general you should avoid using uppercase letters in options names in WordPress.

发布评论

评论列表(0)

  1. 暂无评论