after_switch_theme global is undefined
hey there
i'm trying to pull the compiler function, after the first theme activation, but the global variable seems to be empty
how can i run the compiler after the theme install ?
add_action('after_switch_theme', 'liquida_compiler');
add_filter('redux/options/liquida/compiler', 'liquida_compiler');
function liquida_compiler() {
global $liquida;
////do stuff
}
Per the top of the new issues window: https://github.com/ReduxFramework/redux-framework/blob/master/CONTRIBUTING.md
hello, thanks for your support
this are the config
-
im in redux v3.1.8.12
-
no, im not in dev mode
-
redux is embed just like the demo
save_defaults = true
$this->args = array(
'opt_name' => LIQUIDA_OPTIONS, // This is where your data is stored in the database and also becomes your global variable name.
'display_name' => $theme->get('Name'), // Name that appears at the top of your panel
'display_version' => $theme->get('Version'), // Version that appears at the top of your panel
'menu_type' => 'menu', //Specify if the admin menu should appear or not. Options: menu or submenu (Under appearance only)
'allow_sub_menu' => true, // Show the sections below the admin menu item or not
'menu_title' => __('Liquida Options', 'liquidatheme'),
'page' => __('Liquida Options', 'liquidatheme'),
'google_api_key' => 'AIzaSyBNsacnx37lZpIIyDyNAjGC1qdE7Z0CrEQ', // Must be defined to add google fonts to the typography module
'global_variable' => 'liquida', // Set a different name for your global variable other than the opt_name
'dev_mode' => false, // Show the time the page took to load, etc
'customizer' => true, // Enable basic customizer support
'page_priority' => null, // Order where the menu appears in the admin area. If there is any conflict, something will not show. Warning.
'page_parent' => 'themes.php', // For a full list of options, visit: http://codex.wordpress.org/Function_Reference/add_submenu_page#Parameters
'page_permissions' => 'edit_theme_options', // Permissions needed to access the options panel.
'menu_icon' => LIQUIDA_PARENT_ADMIN_ASSETS_URL . '/images/icons/icon-options.png', // Specify a custom URL to an icon
'last_tab' => '', // Force your panel to always open to a specific tab (by id)
'page_icon' => 'icon-themes', // Icon displayed in the admin panel next to your menu_title
'page_slug' => 'liquida_options', // Page slug used to denote the panel
'save_defaults' => true, // On load save the defaults to DB before user clicks save or not
'default_show' => false, // If true, shows the default value next to each field that is not the default value.
'default_mark' => '', // What to print by the field's title if the value shown is default. Suggested: *
'transient_time' => 60 * MINUTE_IN_SECONDS,
'output' => true, // Global shut-off for dynamic CSS output by the framework. Will also disable google fonts output
'output_tag' => true, // Allows dynamic CSS to be generated for customizer and google fonts, but stops the dynamic CSS from going to the head
//'domain' => 'redux-framework', // Translation domain key. Don't change this unless you want to retranslate all of Redux.
//'footer_credit' => '', // Disable the footer credit of Redux. Please leave if you can help it.
// FUTURE -> Not in use yet, but reserved or partially implemented. Use at your own risk.
'database' => '', // possible: options, theme_mods, theme_mods_expanded, transient. Not fully functional, warning!
'show_import_export' => true, // REMOVE
'system_info' => false, // REMOVE
'help_tabs' => array(),
'help_sidebar' => '', // __( '', $this->args['domain'] );
);
try using the latest release..its already 3.1.8.22
Please update to the latest version from the repo, v.3.1.8.22 and see if the issue still exists. I can't offer advice on an older version.
i found the fix in this post https://github.com/ReduxFramework/redux-framework/issues/474
add_action('setup_theme', 'liquida_compiler'); add_filter('redux/options/liquida/compiler', 'liquida_compiler');
thanks guys
regards!
Ah, very good! :)
sorry i made a mistake, i forgot to delete the global entry in the DB
so is not fixed yet
i've updated the code to v3.1.8.22 and tried with
add_action('setup_theme', 'liquida_compiler'); add_action('after_setup_theme', 'liquida_compiler'); add_action('after_switch_theme', 'liquida_compiler');
and even calling the compiler directly
add_action('setup_theme', 'redux-compiler-liquida'); add_action('after_setup_theme', 'redux-compiler-liquida'); add_action('after_switch_theme', 'redux-compiler-liquida');
Have you resolved this or not? I am confused. Need your updated code of course to debug. Need an email and exact duplication steps. ;)
Closing ticket for inactivity. Reopen if this is still an issue.