Skip to content

Instantly share code, notes, and snippets.

@proframework
Created May 23, 2014 00:46
Show Gist options
  • Save proframework/a37e928462f72d674fd2 to your computer and use it in GitHub Desktop.
Save proframework/a37e928462f72d674fd2 to your computer and use it in GitHub Desktop.
add_action('admin_notices','themeslug_import_settings');
function themeslug_import_settings()
{
global $pagenow;
if ( is_admin() && $pagenow == "themes.php" && isset( $_GET['activated'] ) ) {
?>
<div class="updated below-h2">
<p style="font-size: 18px;">
<?php _e('<strong>You\'re almost done!</strong> To import settings for this theme,');?> <a href="<?php echo admin_url('themes.php');?>?slug=installchild"><?php _e('click here','generate');?></a>.
</p>
</div>
<?php
}
if ( is_admin() && $pagenow == 'themes.php' && isset( $_GET['slug'] ) ) {
if ($_GET['slug'] == 'installchild') {
?>
<div class="updated below-h2">
<p>
<?php _e('Child theme successfully installed.','generate'); ?>
</p>
</div>
<?php
$rawdata = file_get_contents(esc_url( 'http://url-to/settings.dat' ));
$import = unserialize($rawdata);
foreach ($import as $key => $item) {
update_option($key, $item);
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment