forked from wp-cli/wp-cli
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpost_type_extended.mustache
32 lines (27 loc) · 1.77 KB
/
post_type_extended.mustache
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
<?php
function {{machine_name}}_init() {
{{output}}
}
add_action( 'init', '{{machine_name}}_init' );
function {{machine_name}}_updated_messages( $messages ) {
global $post;
$permalink = get_permalink( $post );
$messages['{{slug}}'] = array(
0 => '', // Unused. Messages start at index 1.
1 => sprintf( __('{{label_ucfirst}} updated. <a target="_blank" href="%s">View {{label}}</a>', '{{textdomain}}'), esc_url( $permalink ) ),
2 => __('Custom field updated.', '{{textdomain}}'),
3 => __('Custom field deleted.', '{{textdomain}}'),
4 => __('{{label_ucfirst}} updated.', '{{textdomain}}'),
/* translators: %s: date and time of the revision */
5 => isset($_GET['revision']) ? sprintf( __('{{label_ucfirst}} restored to revision from %s', '{{textdomain}}'), wp_post_revision_title( (int) $_GET['revision'], false ) ) : false,
6 => sprintf( __('{{label_ucfirst}} published. <a href="%s">View {{label}}</a>', '{{textdomain}}'), esc_url( $permalink ) ),
7 => __('{{label_ucfirst}} saved.', '{{textdomain}}'),
8 => sprintf( __('{{label_ucfirst}} submitted. <a target="_blank" href="%s">Preview {{label}}</a>', '{{textdomain}}'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ),
9 => sprintf( __('{{label_ucfirst}} scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview {{label}}</a>', '{{textdomain}}'),
// translators: Publish box date format, see http://php.net/date
date_i18n( __( 'M j, Y @ G:i' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
10 => sprintf( __('{{label_ucfirst}} draft updated. <a target="_blank" href="%s">Preview {{label}}</a>', '{{textdomain}}'), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ),
);
return $messages;
}
add_filter( 'post_updated_messages', '{{machine_name}}_updated_messages' );