Repository navigation
Expand file tree
/
Copy pathpost_type_extended.mustache
More file actions
81 lines (70 loc) · 4.17 KB
/
Copy pathpost_type_extended.mustache
File metadata and controls
81 lines (70 loc) · 4.17 KB
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
/**
* Custom post type
*
* @package {{prefix}}
*/
/**
* Registers the `{{machine_name}}` post type.
*/
function {{prefix}}_init() {
{{output}}
}
add_action( 'init', '{{prefix}}_init' );
/**
* Sets the post updated messages for the `{{machine_name}}` post type.
*
* @param array $messages Post updated messages.
* @return array Messages for the `{{machine_name}}` post type.
*/
function {{prefix}}_updated_messages( $messages ) {
global $post;
$permalink = get_permalink( $post );
$messages['{{slug}}'] = array(
0 => '', // Unused. Messages start at index 1.
/* translators: %s: post permalink */
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, // phpcs:ignore WordPress.Security.NonceVerification.Recommended
/* translators: %s: post permalink */
6 => sprintf( __( '{{label_ucfirst}} published. <a href="%s">View {{label}}</a>', '{{textdomain}}' ), esc_url( $permalink ) ),
7 => __( '{{label_ucfirst}} saved.', '{{textdomain}}' ),
/* translators: %s: post permalink */
8 => sprintf( __( '{{label_ucfirst}} submitted. <a target="_blank" href="%s">Preview {{label}}</a>', '{{textdomain}}' ), esc_url( add_query_arg( 'preview', 'true', $permalink ) ) ),
/* translators: 1: Publish box date format, see https://secure.php.net/date 2: Post permalink */
9 => sprintf( __( '{{label_ucfirst}} scheduled for: <strong>%1$s</strong>. <a target="_blank" href="%2$s">Preview {{label}}</a>', '{{textdomain}}' ), date_i18n( __( 'M j, Y @ G:i', '{{textdomain}}' ), strtotime( $post->post_date ) ), esc_url( $permalink ) ),
/* translators: %s: post 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', '{{prefix}}_updated_messages' );
/**
* Sets the bulk post updated messages for the `{{machine_name}}` post type.
*
* @param array $bulk_messages Arrays of messages, each keyed by the corresponding post type. Messages are
* keyed with 'updated', 'locked', 'deleted', 'trashed', and 'untrashed'.
* @param int[] $bulk_counts Array of item counts for each message, used to build internationalized strings.
* @return array Bulk messages for the `{{machine_name}}` post type.
*/
function {{prefix}}_bulk_updated_messages( $bulk_messages, $bulk_counts ) {
global $post;
$bulk_messages['{{slug}}'] = array(
/* translators: %s: Number of {{label_plural}}. */
'updated' => _n( '%s {{label}} updated.', '%s {{label_plural}} updated.', $bulk_counts['updated'], '{{textdomain}}' ),
'locked' => ( 1 === $bulk_counts['locked'] ) ? __( '1 {{label}} not updated, somebody is editing it.', '{{textdomain}}' ) :
/* translators: %s: Number of {{label_plural}}. */
_n( '%s {{label}} not updated, somebody is editing it.', '%s {{label_plural}} not updated, somebody is editing them.', $bulk_counts['locked'], '{{textdomain}}' ),
/* translators: %s: Number of {{label_plural}}. */
'deleted' => _n( '%s {{label}} permanently deleted.', '%s {{label_plural}} permanently deleted.', $bulk_counts['deleted'], '{{textdomain}}' ),
/* translators: %s: Number of {{label_plural}}. */
'trashed' => _n( '%s {{label}} moved to the Trash.', '%s {{label_plural}} moved to the Trash.', $bulk_counts['trashed'], '{{textdomain}}' ),
/* translators: %s: Number of {{label_plural}}. */
'untrashed' => _n( '%s {{label}} restored from the Trash.', '%s {{label_plural}} restored from the Trash.', $bulk_counts['untrashed'], '{{textdomain}}' ),
);
return $bulk_messages;
}
add_filter( 'bulk_post_updated_messages', '{{prefix}}_bulk_updated_messages', 10, 2 );