[wp-hackers] Adding post_status (to a specific post type)

Tom Barrett tcbarrett at gmail.com
Wed Apr 4 14:33:55 UTC 2012


Ngrk!

Actually, what I had was: "All (3) | Published (1) | Drafts (2) | "

Looking through wp-includes/post-php it seems I am missing the label count.
Which makes the actual answer:

register_post_status( 'archive', array(
  'label'                     => _x( 'Archived', 'post' ),
  'public'                    => false,
  'exclude_from_search'       => true,
  'show_in_admin_all_list'    => false,
  'show_in_admin_status_list' => true,
  'label_count'               => _n_noop( 'Archived <span
class="count">(%s)</span>', 'Archived <span class="count">(%s)</span>' ),
) );

Have updated the codex with the parameter just in case it saves anyone else
a few hours 8-}

On 4 April 2012 14:19, Tom Barrett <tcbarrett at gmail.com> wrote:

> I think you are saying what I was expecting. It is not what I am seeing
> though.
>
> I'll leave the post type bit aside for now.
>
> I have 4 posts: 2 draft, 1 publish, 1 archive
>
> I can see: All (3) | Published (1) | Drafts (2)
>
> How do I get it to show either:
>  All (3) | Published (1) | Drafts (2) | Registered (1)
> or
>  All (4) | Published (1) | Drafts (2) | Registered (1)
> ?
>
> At one point "All (3)" showed all 4 posts. But at no point can I get the
> new post status to appear anywhere.
>
>
> On 4 April 2012 13:47, Lionel POINTET <lionel.pointet at globalis-ms.com>wrote:
>
>> Hi Tom,
>>
>> A post status is applicable to all types of post, regular (WP) types or
>> even custom types you defined.
>> When you *set* this status to a particular post, a new "filter" will
>> appear
>> before the list of posts, near the "All" link and the other statuses.
>> Indeed, you defined the "show_in_admin_status_list" key to "true" but the
>> filtering by status is displayed only if there are already some posts with
>> this status.
>>
>> That said, you'll need to define a new meta-box or other form stuff so
>> that
>> you'll be able to set your new status to your custom status, because
>> WordPress doesn't display new statuses in the core drop down list.
>>
>> Lionel
>>
>> 2012/4/4 Tom Barrett <tcbarrett at gmail.com>
>>
>> > I have this post status:
>> >
>> >  register_post_status( 'archive', array(
>> >    'label'                     => _x( 'Archived', 'post' ),
>> >    'public'                    => false,
>> >    'exclude_from_search'       => true,
>> >    'show_in_admin_all_list'    => false,
>> >    'show_in_admin_status_list' => true
>> >  ) );
>> >
>> > Is there any way to get the label to appear anywhere on the WordPress
>> > backend admin?
>> >
>> > The filtering works if I update the params, like so:
>> > wp-admin/edit.php?post_status=archive&post_type=paper
>> >
>> > Ideally I would restrict this to a particular post type (or set of post
>> > types).
>> >
>> > --
>> > http://www.tcbarrett.com | http://gplus.to/tcbarrett |
>> > http://twitter.com/tcbarrett
>> > _______________________________________________
>> > wp-hackers mailing list
>> > wp-hackers at lists.automattic.com
>> > http://lists.automattic.com/mailman/listinfo/wp-hackers
>> >
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> http://www.tcbarrett.com | http://gplus.to/tcbarrett |
> http://twitter.com/tcbarrett
>



-- 
http://www.tcbarrett.com | http://gplus.to/tcbarrett |
http://twitter.com/tcbarrett


More information about the wp-hackers mailing list