Last active
June 19, 2016 15:27
-
-
Save nguyenvanduocit/9e4ab194fe0791548e7d9fa7452e13fa to your computer and use it in GitHub Desktop.
Post Status Template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"fields": { | |
"slug": { | |
"type": "text", | |
"label": "Name", | |
"value": "unread", | |
"placeholder": "", | |
"description": "Name of the post status. Maximum length is 20 characters.", | |
"required": true | |
}, | |
"singular_name": { | |
"type": "text", | |
"label": "Singular label", | |
"value": "Unread", | |
"placeholder": "", | |
"description": "", | |
"required": true | |
}, | |
"plural_name": { | |
"type": "text", | |
"label": "Plural label", | |
"value": "Unreads", | |
"placeholder": "", | |
"description": "", | |
"required": true | |
}, | |
"public": { | |
"type": "checkbox", | |
"label": "Is public", | |
"value": true, | |
"placeholder": "", | |
"description": "Whether posts of this status should be shown in the front end of the site.", | |
"required": true | |
}, | |
"show_in_admin_all_list": { | |
"type": "checkbox", | |
"label": "Show in admin all list", | |
"value": true, | |
"placeholder": "", | |
"description": "Whether to include posts in the edit listing for their post type.", | |
"required": true | |
}, | |
"show_in_admin_status_list": { | |
"type": "checkbox", | |
"label": "Show in admin status list", | |
"value": true, | |
"placeholder": "", | |
"description": "Show in the list of statuses with post counts at the top of the edit listings, e.g. All (12) , Published (9) , My Custom Status (2) ...", | |
"required": true | |
}, | |
"exclude_from_search": { | |
"type": "checkbox", | |
"label": "Exclude from search", | |
"value": true, | |
"placeholder": "", | |
"description": " Whether to exclude posts with this post status from search results.", | |
"required": true | |
} | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "Post Status", | |
"templates": [ | |
{ | |
"file": "register.php", | |
"title": "Register new post type" | |
}, | |
{ | |
"file": "usage.php", | |
"title": "Usage" | |
} | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function {{function_prefix}}_register_{{slug}}_post_status(){ | |
register_post_status( '{{slug}}', array( | |
'label' => _x( '{{singular_name}}', 'post' ), | |
'public' => {{public}}, | |
'exclude_from_search' => {{exclude_from_search}}, | |
'show_in_admin_all_list' => {{show_in_admin_all_list}}, | |
'show_in_admin_status_list' => {{show_in_admin_status_list}}, | |
'label_count' => _n_noop( '{{singular_name}} <span class="count">(%s)</span>', '{{plural_name}} <span class="count">(%s)</span>' ), | |
) ); | |
} | |
add_action( 'init', '{{function_prefix}}_register_{{slug}}_post_status()' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php $args = array( | |
'post_status' => '{{slug}}' | |
); | |
$posts_array = get_posts( $args ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment