WordPress.org

Make WordPress Core

Ticket #18516: test-wp-posts-list-table-patch.php

File test-wp-posts-list-table-patch.php, 1.5 KB (added by brandondove, 4 years ago)

A simple plugin that adds a custom class to the single row on the post edit screen

Line 
1<?php
2
3/*
4Plugin Name: Tests for WP_Posts_List_Table Patch (#18516)
5Plugin URI: http://core.trac.wordpress.org/ticket/18516
6Description: Tests adding a custom value to the WP_Posts_List_Table single row
7Version: 0.1
8Author: brandondove
9Author URI: http://pixeljar.net
10*/
11
12/**
13 * Copyright (c) 2011 brandondove. All rights reserved.
14 *
15 * Released under the GPL license
16 * http://www.opensource.org/licenses/gpl-license.php
17 *
18 * This is an add-on for WordPress
19 * http://wordpress.org/
20 *
21 * **********************************************************************
22 * This program is free software; you can redistribute it and/or modify
23 * it under the terms of the GNU General Public License as published by
24 * the Free Software Foundation; either version 2 of the License, or
25 * (at your option) any later version.
26 *
27 * This program is distributed in the hope that it will be useful,
28 * but WITHOUT ANY WARRANTY; without even the implied warranty of
29 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
30 * GNU General Public License for more details.
31 * **********************************************************************
32 */
33
34
35
36/**
37* Test new post_class functionality.
38*/
39class bd_test_posts_list_table_test {
40       
41        function __construct() {
42                add_filter( 'post_class', array( &$this, 'post_class' ) );
43        }
44       
45        function post_class( $classes ) {
46                global $post, $current_screen;
47               
48                if( $current_screen->id == 'edit-post' )
49                        $classes[] = "custom-class";
50               
51                return $classes;
52        }
53       
54}
55if( is_admin() ) :
56        new bd_test_posts_list_table_test;
57endif;