Skip to content

Instantly share code, notes, and snippets.

View engelen's full-sized avatar

Jesper van Engelen engelen

  • Leiden, The Netherlands
View GitHub Profile
<?php
/*
Plugin Name: My Plugin
Author: Jesper van Engelen
Author URI: http://jepps.nl
*/
/**
* Main plugin class for My Plugin
*/
<?php
class JWF_Fields
{
protected static $fieldtypes = array();
/**
* Using a private constructor to make sure the class doesn't get instantiated
*
* @access private
<?php
/*
Plugin Name: My Plugin
Version: 0.1
*/
class JWF_Plugin
{
/**
<?php
add_action( 'cac/loaded', 'myplugin_admincolumns_loaded' );
function myplugin_admincolumns_loaded( $cac_instance ) {
// Stuff!
}
?>
<?php
add_filter( 'cac/column/default_options', 'myplugin_cac_column_default_options', 10, 2 );
function myplugin_cac_column_default_options( $default_options, $column_instance ) {
// Stuff!
}
?>
<?php
add_filter( 'cac/column/default_options', 'myplugin_cac_title_column_editable', 10, 2 );
function myplugin_cac_title_column_editable( $default_options, $column_instance ) {
if ( $column_instance->properties->type == 'title' && ! empty( $column_instance->properties->is_ed
) ) {
$default_options['edit'] = 'on';
}
return $default_options;
<?php
add_filter( 'cac/post_types', 'myplugin_cac_post_types' );
function myplugin_cac_post_types( $post_types ) {
// Stuff!
}
?>
<?php
add_filter( 'cac/post_types', 'myplugin_cac_disable_posttype_post' );
function myplugin_cac_disable_posttype_post( $post_types ) {
if ( isset( $post_types['post'] ) ) {
unset( $post_types['post'] );
}
return $post_types;
}
<?php
add_filter( 'cac/is_cac_screen', 'myplugin_is_cac_screen' );
function myplugin_is_cac_screen( $is_cac_screen ) {
// Possibly modify $is_cac_screen
return $is_cac_screen;
}
?>
<?php
add_filter( 'cac/is_cac_screen', 'myplugin_wpml_is_cac_screen' );
function myplugin_wpml_is_cac_screen( $is_columns_screen ) {
if ( isset( $_GET['page'] ) && $_GET['page'] == 'wpml-string-translation/menu/string-translation.php' ) {
return true;
}
return $is_columns_screen;
}