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
add_filter( 'cac/column/meta/value', 'myplugin_column_meta_value', 10, 4 ); // Meta (custom field) columns for all content types
function myplugin_column_meta_value( $value, $object_id, $column, $storage_type ) {
// Possibly modify $value
return $value;
}
?>
<?php
add_filter( 'cac/column/meta/value', 'myplugin_cac_column_format_numbers', 10, 3 );
function myplugin_cac_column_format_numbers( $value, $postid, $column, $post_type ) {
$numval = floatval( $value );
if ( $value == $numval ) {
$value = number_format_i18n( $numval, 2 );
}
<?php
add_filter( 'cac/column/value', 'myplugin_cac_column_featured_image_value', 10, 4 );
function myplugin_cac_column_featured_image_value( $value, $postid, $column, $post_type ) {
if ( $column->properties->type == 'column-featured_image' ) {
if ( ! $value ) {
$value = '<em>' . __( 'No featured image', 'myplugin' ) . '</em>';
}
}
<?php
add_filter( 'cac/column/value/user', 'myplugin_users_column_value', 10, 4 ); // Columns on the user overview page
add_filter( 'cac/column/value/page', 'myplugin_posttype_page_column_value', 10, 4 ); // Columns on the page overview
?>
<?php
add_filter( 'cac/column/value', 'myplugin_column_value', 10, 4 ); // All columns for all content types
function myplugin_column_value( $value, $object_id, $column, $storage_type ) {
// Possibly modify $value
return $value;
}
?>
<?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;
}
<?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/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/post_types', 'myplugin_cac_post_types' );
function myplugin_cac_post_types( $post_types ) {
// 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;