HEX
Server: Apache
System: Linux hp3-wp-1011494.hostingp3.local 3.10.0-1160.139.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Nov 3 13:30:41 UTC 2025 x86_64
User: csh2729955 (2121743)
PHP: 7.4.33
Disabled: shell_exec,exec,system,popen,set_time_limit
Upload Files
File: /home/storage/162/3480162/user/htdocs/wp-content/themes/colormag/inc/migration.php
<?php
/**
 * Migration scripts for ColorMag theme.
 *
 * @package    ThemeGrill
 * @subpackage ColorMag
 * @since      ColorMag 2.0.6
 */

// Exit if accessed directly.
if ( ! defined( 'ABSPATH' ) ) {
	exit;
}


/**
 * Migrate the social icons control.
 *
 * @since ColorMag 2.0.6
 */
function colormag_social_icons_control_migrate() {

	$social_icon            = get_theme_mod( 'colormag_social_link_activate', 0 );
	$social_icon_visibility = get_theme_mod( 'colormag_social_link_location_option', 'both' );

	// Disable social icon on header if enabled on footer only.
	if ( 0 !== $social_icon ) {
		set_theme_mod( 'colormag_social_icons_activate', true );
	}

	// Disable social icon on header if enabled on footer only.
	if ( 'footer' === $social_icon_visibility ) {
		set_theme_mod( 'colormag_social_icons_header_activate', false );
	}

	// Disable social icon on footer if enabled on header only.
	if ( 'header' === $social_icon_visibility ) {
		set_theme_mod( 'colormag_social_icons_footer_activate', false );
	}

	$remove_theme_mod_settings = array(
		'colormag_social_link_activate',
		'colormag_social_link_location_option'
	);

	// Loop through the theme mods to remove them.
	foreach ( $remove_theme_mod_settings as $remove_theme_mod_setting ) {
		remove_theme_mod( $remove_theme_mod_setting );
	}

	// Set flag to not repeat the migration process, ie, run it only once.
	update_option( 'colormag_social_icons_control_migrate', true );

}

add_action( 'after_setup_theme', 'colormag_social_icons_control_migrate' );