Last active
August 29, 2015 13:58
-
-
Save nullvariable/10292172 to your computer and use it in GitHub Desktop.
screen options hack code
This file contains hidden or 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
<?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