Simple ways to make admin customizations for WordPress. For example, you can...
Jigsaw::add_column('slides', 'Preview', function($pid){
$data = array();
$data['post'] = new TimberPost($pid);
Timber::render('admin/slide-table-preview.twig', $data);
}, 5);
Jigsaw::add_column(array('slides', 'post'), 'Preview', function($pid){
$data = array();
$data['post'] = new TimberPost($pid);
Timber::render('admin/slide-table-preview.twig', $data);
});
Jigsaw::remove_column('slides', 'author');
Jigsaw::remove_column(array('slides', 'post'), 'author');
Jigsaw::add_toolbar_item('Clear Cache', function(){
$total_cache->flush_all();
});
$optionOne = new stdClass();
$optionOne->label = 'All Caches';
$optionOne->action = function(){
$total_cache->flush_all();
};
$optionTwo = new stdClass();
$optionTwo->label = 'Page Cache';
$optionTwo->action = function(){
$total_cache->flush_page_cache();
};
$optionThree = array('Home', 'http://localhost');
Jigsaw::add_toolbar_group('Clear Cache', array($optionOne, $optionTwo, $optionThree));
Jigsaw::show_notice('Cache has been flushed', 'updated');
...or
Jigsaw::show_notice('Error flushing cache, is the plugin activated?', 'error');
Jigsaw::add_css('css/my-admin-style.css');
#JigsawPermalinks
JigsawPermalinks::set_author_base('writers');
After this you have to reset permalinks to see it working.
JigsawPermalinks::remove_permalink_slug('event');
or
JigsawPermalinks::remove_permalink_slug(array('event', 'book', 'my_other_cpt'));
JigsawPermalinks::set_permalink('gallery', '/galleries/%year%/%gallery%');