Last active
February 6, 2017 12:44
-
-
Save bigdigital/71054caf7a8966e85f621c469c5f8f27 to your computer and use it in GitHub Desktop.
Change metabox defaults The7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function dt_change_metabox_defaults() { | |
global $DT_META_BOXES; | |
if ( $DT_META_BOXES ) { | |
$box_album_options = null; | |
//find dt_page_box-album_options | |
foreach($DT_META_BOXES as &$value) { | |
if ($value['id'] === 'dt_page_box-album_options') { | |
$box_album_options = &$value; | |
break; // Stop iterating after key has been found | |
} | |
} | |
if (!isset($box_album_options)) return; | |
//find _dt_album_options_open_album | |
$box_album_options_open_album = null; | |
$box_album_options_type = null; | |
foreach($box_album_options['fields'] as &$value) { | |
if ($value['id'] === '_dt_album_options_open_album') { | |
$box_album_options_open_album = &$value; | |
break; // Stop iterating after key has been found | |
} | |
} | |
//find _dt_album_options_type | |
foreach($box_album_options['fields'] as &$value) { | |
if ($value['id'] === '_dt_album_options_type') { | |
$box_album_options_type = &$value; | |
break; // Stop iterating after key has been found | |
} | |
} | |
if (isset($box_album_options_open_album['std'])){ | |
$box_album_options_open_album['std'] = 'post'; | |
} | |
if (isset($box_album_options_type['std'])){ | |
$box_album_options_type['std'] = 'photo_scroller'; | |
} | |
} | |
} | |
add_action( 'admin_init', 'dt_change_metabox_defaults', 30); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment