How to have multiple sections in the same theme options page

For my theme, I have created a Settings Page which is shown in the Appearance menu of WordPress admin.

Now, I have been following this tutorial.

Read More

Exactly like the tutorial, I have created multiple sections and I face the issue where only the fields of the last section are saved in the DB while the fields of other sections are not saved.

I do not want to go for the Tabbed Navigation option – I have too many sections.

How do I solve the problem of not being able to save fields of other sections due to the nonce issue?

EDIT: I am using WordPress 3.3.1

Related posts

Leave a Reply

1 comment

  1. Try to separate section forms…

    Just like this:–

    <?php if( $active_tab == 'display_options' ) { ?>
    <form method="post" action="options.php">
        <?php
        settings_fields( 'sandbox_theme_display_options' );
        do_settings_sections( 'sandbox_theme_display_options' );
        submit_button();
        ?>
    </form>
    <?php } else { ?>
    <form method="post" action="options.php">
        <?php
        settings_fields( 'sandbox_theme_social_options' );
        do_settings_sections( 'sandbox_theme_social_options' );
        submit_button();
        ?>
    </form>
    <?php } ?>
    

    May be this will help you…


    In tutorial document, Form is like following…

    <form method="post" action="options.php">
        <?php
    
            if( $active_tab == 'display_options' ) {
                settings_fields( 'sandbox_theme_display_options' );
                do_settings_sections( 'sandbox_theme_display_options' );
            } else {
                settings_fields( 'sandbox_theme_social_options' );
                do_settings_sections( 'sandbox_theme_social_options' );
            } // end if/else
    
            submit_button();
    
        ?>
    </form>
    

    This is also separate form content.