colorway_migrate_option

The ColorWay colorway migrate option function.

Description

colorway_migrate_option(); 

Usage

  1. if ( !function_exists( 'colorway_migrate_option' ) ) { 
  2. require_once '/functions.php'; 
  3.  
  4.  
  5. // NOTICE! Understand what this does before running. 
  6. $result = colorway_migrate_option(); 
  7.  

Defined (1)

The function is defined in the following location(s).

/functions.php  
  1. function colorway_migrate_option() { 
  2. if (get_option('inkthemes_options') && !get_option('colorway_migrate_option')) { 
  3. $theme_option = array('colorway_logo', 'colorway_favicon', 'colorway_slideimage1', 'colorway_slideimage2', 'inkthemes_fimg1', 'inkthemes_fimg2', 'inkthemes_fimg3', 'inkthemes_fimg4', 'inkthemes_testimonial_img', 'inkthemes_testimonial_img_2', 'inkthemes_testimonial_img_3'); 
  4. $wp_upload_dir = wp_upload_dir(); 
  5. require ( ABSPATH . 'wp-admin/includes/image.php' ); 
  6. foreach ($theme_option as $option) { 
  7. $option_value = inkthemes_get_option($option); 
  8. if ($option_value && $option_value != '') { 
  9. $filetype = wp_check_filetype(basename($option_value), null); 
  10. $image_name = preg_replace('/\.[^.]+$/', '', basename($option_value)); 
  11. $new_image_url = $wp_upload_dir['path'] . '/' . $image_name . '.' . $filetype['ext']; 
  12. colorway_import_file($new_image_url); 
  13. update_option('colorway_migrate_option', true);