' . $msg . '

'; } function aspen_extras_error_msg($msg) { echo '

' . $msg . '

'; } //============================================================== // process actions function aspen_extras_process() { // add a nonced form for each needed action if (aspen_extras_submitted('atw_extras_action')) { if (isset($_POST['savethemename']) && $_POST['savethemename'] != '') { $name = esc_html(strtolower(str_replace(' ','-',$_POST['savethemename']))); $aspen_opts = get_option('aspen_settings',array()); $themes = get_option('aspen_switch_themes',array()); $themes[$name]['aspen_base'] = $aspen_opts; update_option('aspen_switch_themes',$themes); aspen_extras_save_msg('Current Aspen Theme Settings saved as subtheme "' . $name . '"'); unset($_POST['atw_extras_action']); } else { aspen_extras_error_msg('No name provided to save theme.'); } } if (aspen_extras_submitted('atw_extras_deleteall')) { delete_option('aspen_switch_themes'); aspen_extras_save_msg('All Themes deleted from saved theme list.'); } if (aspen_extras_submitted('atw_extras_delete')) { if (isset($_POST['deletename']) && $_POST['deletename'] != '') { $to_delete = $_POST['deletename']; $themes = get_option('aspen_switch_themes',array()); if (isset($themes[$to_delete])) unset($themes[$to_delete]); update_option('aspen_switch_themes',$themes); aspen_extras_save_msg('Theme deleted from saved theme list: ' . $_POST['deletename']); } else { aspen_extras_error_msg('No name provided to delete.'); } } if (aspen_extras_submitted('clear_aspen_main')) { delete_option(apply_filters('aspen_options','aspen_settings')); aspen_extras_save_msg("Main Aspen Theme Settings Cleared"); } if (aspen_extras_submitted('clear_aspen_all')) { delete_option(apply_filters('aspen_options','aspen_settings')); delete_option( 'aspen_settings_backup' ); delete_option('aspen_switch_themes'); aspen_extras_save_msg("All Aspen Theme Settings Cleared"); } } function aspen_extras_admin() { if ( !current_user_can( 'manage_options' ) ) { wp_die('You do not have sufficient permissions to access this page.'); } // process commands aspen_extras_process(); // display forms ?>

Aspen Extras

Extra Options for the Aspen Theme


Theme Switcher Administration

The Aspen Extras Theme Switcher is an advanced option that will be really useful to some Aspen Theme users. It allows you to save a copy of your current settings in the WordPress Database using a name of your choosing. That name can then be used set an alternative Per Page subtheme for individual static pages, or dynamically by adding ?atw_theme=subtheme-name to the link to any page on the site.

If you use the link parameter method to switch themes (e.g., http://example.com/altpage/?atw_theme=subtheme-name), then a cookie will be set, and all pages on the site will be displayed with the alternate subtheme for 20 minutes. using ?atw_theme=default will delete the cookie and change back to the default theme.

Create your alternative subtheme using the following instructions, and save it. Then, you can define a Per Page Custom Field for any static page. Set the Name of the Custom Field to aspen_switch_theme. Set the Value> to the name you specify in the "Save Current Theme is Subtheme DB List" below (exactly as it appears in the "Select Theme to Delete" list box). You can set as many pages as you want to use the same subtheme, or you can even use several different saved subthemes. This feature only works for regular static pages or page with posts - no archive-like pages. It also works if you are logged in as an admin, although the alternate theme will not be used for the Page Editor. The link parameter ?atw_theme=name version will work on any page.

Instructions - Saving Alternative Subthemes

  1. Create a subtheme with ALL options set as desired.
  2. Enter a name for your theme - You can be descriptive, but should be short. Name will be normalized to all lower case with blanks converted to dashes (-).
  3. Click the "Save Current Theme as Named" button.
  4. Repeat for each theme you want to define.
  5. To use a saved subtheme on a per page basis, add a Custom Field called aspen_switch_theme to the specific static page from the Pages editor. You can also specify ?atw_theme=name at the end of a link to a page: http://example.com/?atw_theme=blue

Important - Use Save/Restore to save your alternate subthemes

There is no way to retrieve alternative subthemes settings saved from this plugin. You should be sure to use the Save/Restore tab to save a copy of the subthemes used for this plugin in an alternative location such as downloading it to your own computer.


Save Current Theme in Subtheme DB List

" method="post"> Name for saved theme:  Please provide a short name the saved theme, then click the "Save Current Theme as Named" button.

Currently saved subthemes:   $val) { echo '' . $theme . '   '; } ?>

Delete Saved Theme

" method="post">

This drop-down list shows all the subthemes you've saved. Click the Delete button to delete selected sub-theme.


" method="post" onSubmit="return confirm('Are you sure you want to all saved themes?');">

Use this option to delete all the saved themes from the database.


24) { $name = aspen_get_per_page_value('aspen_switch_theme'); $set_cookie = false; // don't set cookie on a per page theme } if ($name == '' && isset($_COOKIE['atw_switch_theme']) ) { // okay, could be a cookie set $name = $_COOKIE['atw_switch_theme']; $set_cookie = false; } if ($name == 'default') { $url = parse_url(home_url( '/' )); $domain = $url['host']; $path = '/'; setcookie('atw_switch_theme',$name,time()-3600,$path,$domain); // 20 minutes (60*20) } else if ($name != '') { // see if there is an alternate per page theme // echo '' . "\n"; // okay - have an alternate theme now - reset basic and pro options $themes = get_option('aspen_switch_themes',array()); if (isset($themes[$name]['aspen_base'])) { // successful switch... $opts = $themes[$name]['aspen_base']; aspen_opt_cache($opts); if ($set_cookie) { // don't reset cookie $url = parse_url(home_url( '/' )); $domain = $url['host']; $path = '/'; setcookie('atw_switch_theme',$name,time()+1200,$path,$domain); // 20 minutes (60*20) } } } } function aspen_x_t_($m) { return $m; } function aspen_x_plugins_url($file,$ext) { return plugins_url($file,__FILE__) . $ext; } //======================================================================== // Clean Settings function aspen_extras_clean() { ?>

Clean Aspen Theme Settings

If you will not be using the Aspen Theme any longer, this Aspen Extras features allows you to remove Aspen settings from the WordPress database. The options will be removed, and can't be recovered once deleted.

IMPORTANT WARNING! - clearing settings will remove your current settings. You should use the Aspen Save/Restore to save you settings to your computer first!

" method="post" onSubmit="return confirm('Are you sure you want to reset main Aspen Theme related settings?');" > -- This will clear just the main Aspen settings.


" method="post" onSubmit="return confirm('Are you sure you want to reset ALL Aspen Theme related settings?');" > -- This will clear Aspen related settings: main theme settings, saved theme settings, all alternate switch themes. Use this option with caution!

Select an Add-on Subtheme You Have Uploaded'; $addon_dir = aspen_f_uploads_base_dir() . 'aspen-subthemes/addon-subthemes/'; $addon_url = aspen_f_uploads_base_url() . 'aspen-subthemes/addon-subthemes/'; $addon_list = array(); if($media_dir = @opendir($addon_dir)){ // build the list of themes from directory while ($m_file = readdir($media_dir)) { $len = strlen($m_file); $base = substr($m_file,0,$len-4); $ext = $len > 4 ? substr($m_file,$len-4,4) : ''; if($ext == '.ath' ) { $addon_list[] = $base; } } } if (!empty($addon_list)) { natcasesort($addon_list); $cur_addon = aspen_getopt('aspopt_addon_name'); if ($cur_addon) echo '

Currently selected Add-on Subtheme: ' . ucwords(str_replace('-',' ',$cur_addon)) . '

'; ?>
" method='post'>

Select an add-on subtheme:

' . "\n"; } ?>

  Note: Selecting a new subtheme will change only theme related settings. Most Advanced Options will be retained. You can use the Save/Restore tab to save a copy of all your current settings first.

 This will delete the selected Add-on Subtheme from the Add-on directory

No Add-on Subthemes available.

Upload an Add-on Subtheme From Your Computer'; ?>
" method="POST">
Select Add-on Subtheme .zip file to upload:
 Upload and Save an Add-on Subtheme or Subtheme collection from .zip file on your computer. Will be saved on your site's filesystem.

Sorry, there was a problem uploading your add on theme. The name you picked did not have a valid Aspen theme file in the /wevaerii-subthemes/addon-subthemes directory.

'; } else { aspen_save_msg('Aspen theme options reset to ' . ucwords(str_replace('-',' ',$name )) . ' add-on subtheme.'); aspen_setopt('aspopt_addon_name',$name); } } } else if (aspen_submitted('delete_added_subtheme') ) { // Delete selected addon theme if (isset($_POST['aspopt_addon_name'])) { $name = $_POST['aspopt_addon_name']; @unlink(aspen_f_uploads_base_dir() . 'aspen-subthemes/addon-subthemes/' . $name . '.ath'); @unlink(aspen_f_uploads_base_dir() . 'aspen-subthemes/addon-subthemes/' . $name . '.jpg'); aspen_save_msg('Deleted ' . ucwords(str_replace('-',' ',$name )) . ' add-on subtheme.'); } } else if (aspen_submitted('upload_addon') && isset($_POST['uploadaddon']) && $_POST['uploadaddon'] == 'yes') { // upload theme from users computer // they've supplied and uploaded a file $ok = aspen_unpackzip('uploaded_addon', aspen_f_uploads_base_dir() . 'aspen-subthemes/addon-subthemes/'); } else if (aspen_submitted('upload_theme')) { // upload theme from users computer // they've supplied and uploaded a file if (isset($_FILES['uploaded_theme']['name'])) // uploaded_theme $filename = $_FILES['uploaded_theme']['name']; else $filename = ""; $to = aspen_f_themes_dir(); if (strpos($filename,'aspen-') === false && strpos($filename, 'aspen-') === false) { ?>

ERROR

You did not select an Aspen theme .zip file: "". The theme file name must start with 'aspen-'. Please use a file you downloaded from AspenTheme.com .

"; $ok = false; } if ($filename == "") { $errors[] = "You didn't select a file to upload.
"; $ok = false; } if ($ok && $ext_check != 'zip'){ $errors[] = "Uploaded files must have .zip extension.
"; $ok = false; } if ($ok) { if (!aspen_f_exists($openname)) { $errors[] = ' Sorry, there was a problem uploading your file. You may need to check your folder permissions or other server settings.
' . "(Trying to use file '$openname')"; $ok = false; } } if ($ok) { // should be ready to go, but check out WP_Filesystem if (! WP_Filesystem()) { function aspen_ex_return_direct() { return 'direct'; } add_filter('filesystem_method', 'aspen_ex_return_direct'); $try2 = WP_Filesystem(); remove_filter('filesystem_method', 'aspen_ex_return_direct'); if (!$try2) { $errors[] = 'Sorry, there\'s a problem trying to use the WordPress unzip function. Please see the FAQ at weavertheme.com support for more information.'; $ok = false; } } } if ($ok) { // $openname has uploaded .zip file to use // $filename has name of file uploaded $is_error = unzip_file( $openname, $to_dir ); if ( !is_wp_error( $is_error ) ) { aspen_save_msg('File ' . $filename . ' successfully uploaded and unpacked to:
' . $to_dir); @unlink($openname); // delete temp file... } else { $errors[] = "Sorry, unpacking the .zip you selected file failed. You may have a corrupt .zip file, or there many a file permissions problem on your WordPress installation."; $errors[] = $is_error->get_error_message(); $ok = false; } } if (!$ok) { echo '

ERROR

'; foreach($errors as $error){ echo $error.'
'; } echo '

'; } return $ok; } if (ASPEN_MARKET) add_action('aspen_child_saverestore','aspen_child_saverestore_action'); function aspen_child_saverestore_action() { echo '

Use the Aspen Subthemes tab to upload Add-on Subthemes.

You can upload extra add-on subthemes you\'ve downloaded using the Aspen Subthemes tab. Note: the Save and Restore options on this page are for the custom settings you have created. These save/restore options are not related to Add-on Subthemes, although you can modify an Add-on Subtheme, and save your changes here.

'; } add_action('aspen_child_update','aspen_child_update_action'); function aspen_child_update_action() { echo '

*** Update Aspen theme from .zip file on your computer. ***

'; if ((!is_multisite() && current_user_can('install_themes')) || (is_multisite() && current_user_can('manage_network_themes'))) { ?>
" method="POST">

This action will update the version of Aspen you are using right now with a version you've downloaded from AspenTheme.com. Normally you can update Aspen using the standard WordPress theme update process. This process will make it easy to update Aspen with the latest version from AspenTheme.com before it becomes available on WordPress.org.

 Select Aspen .zip file with version to update.
 Update Aspen -- Upload 'aspen' .zip file and upgrade theme.
WARNING! -- It appears your system upload file size limit is less than 2Mb, which is too small for the Aspen theme .zip file. The upload is likely to hang and fail if you continue. If your system limit is indeed less than 2Mb, you will need to have it raised before you proceed. This may involve contacting your hosting company.

'; } aspen_nonce_field('upload_theme'); ?>

Note - using this Aspen theme update tool will directly update your /wp-content/themes/aspen/ directory with the new version. Any files you may have added to one of that directory, such as a new language translation file, will not be removed. Thus, this provides an easy way to update Aspen while retaining any new files you may have added.

You must be an Admin or Super-Admin to update Aspen.

'; } } ?>