Php Wordpress主题选项页面-单选按钮未正确更新

Php Wordpress主题选项页面-单选按钮未正确更新,php,wordpress,radio-button,themes,Php,Wordpress,Radio Button,Themes,我目前正在Wordpress主题的主题选项页面上工作 我使用Ian Steward的“”作为基础: 情况: 我实现了两组单选按钮,如下所示: 问题是: 它们按计划工作,应用所选选项 唯一的问题:保存后,所选单选按钮不再被选中 对于上图:如果我更改两个单选按钮并单击“保存”,则在再次加载页面后,仅选择第一个单选按钮 守则: 从theme-options.php中: // Normal/Fixed Navigation Options $fixed_navigation_options = arr

我目前正在Wordpress主题的主题选项页面上工作

我使用Ian Steward的“”作为基础:

情况: 我实现了两组单选按钮,如下所示:

问题是: 它们按计划工作,应用所选选项

唯一的问题:保存后,所选单选按钮不再被选中

对于上图:如果我更改两个单选按钮并单击“保存”,则在再次加载页面后,仅选择第一个单选按钮

守则: 从theme-options.php中:

// Normal/Fixed Navigation Options
$fixed_navigation_options = array(
    'Normal' => array(
        'value' => ' ',
        'label' => __( 'Normal', 'arrowcatch' )
    ),
    'Fixed' => array(
        'value' => 'is-fixed',
        'label' => __( 'Fixed', 'arrowcatch' )
    )
);


// Full-width/Contained Navigation Options
$contained_navigation_options = array(
    'Full-width' => array(
        'value' => ' ',
        'label' => __( 'Full-width', 'arrowcatch' )
    ),
    'Contained' => array(
        'value' => 'is-contained',
        'label' => __( 'Contained', 'arrowcatch' )
    )
);

函数箭头捕捉主题选项页面(){
全局$select\u options、$fixed\u navigation\u options、$contained\u navigation\u options;
如果(!isset($_请求['settings-updated']))
$\u请求['settings-updated']=false;?>
已保存选项!






希望这就是所有需要的代码

不知道那里发生了什么

我非常感谢你朝着正确的方向努力


谢谢!

echo anywere$options['fixed\u navigation']并将其与$option['value']进行比较,patebin/告诉我们结果;在“全宽/包含导航”部分,您有if('''.=$Contained\u navigation\u设置){if($options['fixed\u navigation']==$option['value'])。不应该是if($options)吗['contained_navigation']==$option['value'])?嗨,alex alex,哇,“($options['contained_navigation']==$option['value'])到底哪里出了问题。现在一切都很好。非常感谢,我没看到那个错误。
function arrowcatch_theme_options_page() {
global $select_options, $fixed_navigation_options, $contained_navigation_options;
if ( ! isset( $_REQUEST['settings-updated'] ) )
    $_REQUEST['settings-updated'] = false; ?>

<div class="wrap"> 

<?php if ( false !== $_REQUEST['settings-updated'] ) : ?> 
<div class="updated fade">
    <p><strong>Options saved!</strong></p>
</div>
<?php endif; ?>
<!-- Normal/Fixed Navigation -->
    <tr valign="top"><th scope="row"><?php _e( 'Navigation Normal/Fixed', 'arrowcatch' ); ?></th>
        <td>
            <fieldset><legend class="screen-reader-text"><span><?php _e( 'Navigation Normal/Fixed', 'arrowcatch' ); ?></span></legend>
            <?php
                if ( ! isset( $checked ) )
                    $checked = '';
                foreach ( $fixed_navigation_options as $option ) {
                    $fixed_navigation_setting = $options['fixed_navigation'];
                    if ( '' != $fixed_navigation_setting ) {
                        if ( $options['fixed_navigation'] == $option['value'] ) {
                            $checked = "checked=\"checked\"";
                        } else {
                            $checked = '';
                        }
                    }
                    ?>
                    <label class="description"><input type="radio" name="arrowcatch_theme_options[fixed_navigation]" value="<?php esc_attr_e( $option['value'] ); ?>" <?php echo $checked; ?> /> <?php echo $option['label']; ?></label><br />
                    <?php
                }
            ?>
            </fieldset>
        </td>
    </tr>


<!-- Full-width/Contained Navigation -->
    <tr valign="top"><th scope="row"><?php _e( 'Navigation Full-width/Contained', 'arrowcatch' ); ?></th>
        <td>
            <fieldset><legend class="screen-reader-text"><span><?php _e( 'Navigation Full-width/Contained', 'arrowcatch' ); ?></span></legend>
            <?php
                if ( ! isset( $checked ) )
                    $checked = '';
                foreach ( $contained_navigation_options as $option ) {
                    $contained_navigation_setting = $options['contained_navigation'];
                    if ( '' != $contained_navigation_setting ) {
                        if ( $options['fixed_navigation'] == $option['value'] ) {
                            $checked = "checked=\"checked\"";
                        } else {
                            $checked = '';
                        }
                    }
                    ?>
                    <label class="description"><input type="radio" name="arrowcatch_theme_options[contained_navigation]" value="<?php esc_attr_e( $option['value'] ); ?>" <?php echo $checked; ?> /> <?php echo $option['label']; ?></label><br />
                    <?php
                }
            ?>
            </fieldset>
        </td>
    </tr>