Skip to content

Instantly share code, notes, and snippets.

@nullvariable
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save nullvariable/10292172 to your computer and use it in GitHub Desktop.
Save nullvariable/10292172 to your computer and use it in GitHub Desktop.
screen options hack code
<?php
$screen = get_current_screen();
add_filter('manage_' . $screen->id . '_columns', 'my_true_false_option');
function my_true_false_option() {
return array("my_true_false_option" => __("My True/False Option", 'translation-context'));
}
?>
<table id="fake_column">
<tr><th scope="col" id="my_true_false_option" class="manage-column column-my_true_false_option" style=""></th></tr>
<tr><td class="column-my_true_false_option"></td></tr>
</table>
<?php
function my_true_false_option_value() {
//return false if unchecked, true if checked
$screen = get_current_screen();
$hiddencols = get_hidden_columns($screen);
foreach ($hiddencols as $col) {
if ($col == 'my_true_false_option') { return false; }
}
return true;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment