Пример #1
0
     */
    public function wpdn_dashboard_columns($columns)
    {
        global $current_screen;
        if ($current_screen->id) {
            $columns['add_note'] = __('Add note', 'wp-dashboard-notes');
        }
        return $columns;
    }
}
/**
 * The main function responsible for returning the WP_Dashboard_Notes object.
 *
 * Use this function like you would a global variable, except without needing to declare the global.
 *
 * Example: <?php WP_Dashboard_Notes()->method_name(); ?>
 *
 * @since 1.0.0
 *
 * @return object WP_Dashboard_Notes class object.
 */
if (!function_exists('WP_Dashboard_Notes')) {
    function WP_Dashboard_Notes()
    {
        return WP_Dashboard_Notes::instance();
    }
}
WP_Dashboard_Notes();
// Backwards compatibility
$GLOBALS['wp_dashboard_notes'] = WP_Dashboard_Notes();
 * @package		WP Dashboard Notes
 * @author		Jeroen Sormani
 */
class Note_Post_Type
{
    /**
     * Constructor.
     *
     * @since 1.0.0
     */
    public function __construct()
    {
        // Register post type
        add_action('init', array($this, 'register_post_type'));
    }
    /**
     * Register post type.
     *
     * Register and set settings for post type 'note'.
     *
     * @since 1.0.0
     */
    public function register_post_type()
    {
        $labels = array('name' => __('Notes', 'wp-dashboard-notes'), 'singular_name' => __('Note', 'wp-dashboard-notes'), 'add_new' => __('Add New', 'wp-dashboard-notes'), 'add_new_item' => __('Add New Note', 'wp-dashboard-notes'), 'edit_item' => __('Edit Note', 'wp-dashboard-notes'), 'new_item' => __('New Note', 'wp-dashboard-notes'), 'view_item' => __('View Note', 'wp-dashboard-notes'), 'search_items' => __('Search Notes', 'wp-dashboard-notes'), 'not_found' => __('No Notes', 'wp-dashboard-notes'), 'not_found_in_trash' => __('No Notes found in Trash', 'wp-dashboard-notes'));
        register_post_type('note', array('label' => 'note', 'show_ui' => false, 'show_in_menu' => false, 'capability_type' => 'post', 'map_meta_cap' => true, 'rewrite' => array('slug' => 'notes'), '_builtin' => false, 'query_var' => true, 'supports' => array('title', 'editor'), 'labels' => $labels));
    }
}
// Backwards compatibility
$GLOBALS['wpdn_post_type'] = WP_Dashboard_Notes()->post_type;