Custom Template/CSS gets arbitrarily reset to default
-
There appears to be a logic issue that causes a custom template and CSS to be reset to the default every time the plugin is deactivated and then activated. This can happen, for example, if you edit the plugin code within WordPress. If you’ve spent any time building your template to then have it disappear this will probably be why.
So in classes\staff_settings.php I replaced lines 21 through 35 with the below. It seemed to resolve the issue, BYMMV.// ATI This was || below, but that meant that every time the plugin was deactivated and then // reactivated, the custom template and CSS got reset. Using && makes sure this only happens when // first setting things up and only if staff_directory_custom_templates has not previously been set. // Also moved the cleanup of staff_directory_html_template and staff_directory_css_template // to happen even if the condition below is not met. } else if ($current_template_slug == 'custom' && get_option('staff_directory_html_template', '') != '' && get_option('staff_directory_custom_templates') == '') { $templates_array = array(); $templates_array[] = array( 'html' => get_option('staff_directory_html_template'), 'css' => get_option('staff_directory_css_template') ); $staff_settings->updateCustomStaffTemplates($templates_array); $staff_settings->updateDefaultStaffTemplateSlug('custom_1'); } if (get_option('staff_directory_html_template', '') != '') { delete_option('staff_directory_html_template'); delete_option('staff_directory_css_template'); } }
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘Custom Template/CSS gets arbitrarily reset to default’ is closed to new replies.