Skip to main content
updated
Source Link
Bainternet
  • 67.7k
  • 8
  • 131
  • 188

I found this on the codex

You can only use conditional query tags on or after the init action hook in WordPress. For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php, i.e. outside of a function.

update

you don't need to hook the register sidebar function just call it like this:

add_action( 'after_setup_theme', 'aad_theme_setup' );

function aad_theme_setup() {

    if ( function_exists( 'get_option_tree') ) {
        $theme_options = get_option('option_tree');
    }
get_option_tree
    if ($theme_options['aad_sliding_sidebar']=='yes') {
        aad_register_sidebar_function();
    }
}

but make sure that you can access your option_tree option because you are checking if "get_option_tree" function exists but you are using "get_option" and also maybe but just maybe in your code you are calling "aad_register_sidebar_function()" instead of "add_register_sidebar_function()" two "aa" and not two "dd" ?

I found this on the codex

You can only use conditional query tags on or after the init action hook in WordPress. For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php, i.e. outside of a function.

I found this on the codex

You can only use conditional query tags on or after the init action hook in WordPress. For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php, i.e. outside of a function.

update

you don't need to hook the register sidebar function just call it like this:

add_action( 'after_setup_theme', 'aad_theme_setup' );

function aad_theme_setup() {

    if ( function_exists( 'get_option_tree') ) {
        $theme_options = get_option('option_tree');
    }
get_option_tree
    if ($theme_options['aad_sliding_sidebar']=='yes') {
        aad_register_sidebar_function();
    }
}

but make sure that you can access your option_tree option because you are checking if "get_option_tree" function exists but you are using "get_option" and also maybe but just maybe in your code you are calling "aad_register_sidebar_function()" instead of "add_register_sidebar_function()" two "aa" and not two "dd" ?

Source Link
Bainternet
  • 67.7k
  • 8
  • 131
  • 188

I found this on the codex

You can only use conditional query tags on or after the init action hook in WordPress. For themes, this means the conditional tag will never work properly if you are using it in the body of functions.php, i.e. outside of a function.