Skip to content

Instantly share code, notes, and snippets.

Last active Apr 14, 2021
What would you like to do?
// This constant should be defined in the main file for the plugin, even if the rest of this code is loaded elsewhere
define( 'ELODIN_STAFF_DIR', plugin_dir_path( __FILE__ ) );
use AC\ListScreenRepository\Storage\ListScreenRepositoryFactory;
use AC\ListScreenRepository\Rules;
use AC\ListScreenRepository\Rule;
add_filter( 'acp/storage/repositories', function( array $repositories, ListScreenRepositoryFactory $factory ) {
//! Change $writable to true to allow changes to columns for the content types below
$writable = false;
// Add rules to target individual list tables.
// Defaults to Rules::MATCH_ANY added here for clarity, other option is Rules::MATCH_ALL
$rules = new Rules( Rules::MATCH_ANY );
$rules->add_rule( new Rule\EqualType( 'staff' ) );
// Register your repository to the stack
$repositories['elodin-staff'] = $factory->create(
ELODIN_STAFF_DIR . '/acp-settings',
return $repositories;
}, 10, 2 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment