6

ANSWER MOD: just an important mod to the chosen answer:

// check if you actually have drafts; also avoids extra '|' separator
if (isset($views['draft'])) {
    // 'Drafts' should be added (and come first) if you don't want to end up with 'Unavailables'
    $views['draft'] = str_replace(array('Drafts','Draft'), 'Unavailable', $views['draft']);
}

and the mentioned caveat is not showing up for me on 3.4. :D


Only for one particular custom post type employee, I want to change the name/string "Draft" (which stands for the 'draft' status) to "Unavailable" for any employee post that has a 'draft' status, anywhere the name shows up on the admin screens and basically throughout the entire site, i.e.

enter image description here

Is there a hook for this? Or is there a better way to do this?

2

1 Answer 1

4

I was investigating the issue for this question, and one option is using the plugin Edit Flow.

It can be configured to display custom post_status in specific CPT's, but further tests are necessary to see if it applies to this case.


Other option is using toscho's Retranslate plugin, where you can define the string to be translated and the post_type: https://wordpress.stackexchange.com/a/3675/12615

It gets almost all the job done, because, curiously, there's one string (the very first one of the screenshot) that don't gets translated and one extra code is necessary:

add_filter( 'views_edit-employee', 'wpse_54330_custom_draft_translation', 10, 1);

function wpse_54330_custom_draft_translation( $views ) 
{
    $views['draft'] = str_replace('Draft', 'Unavailable', $views['draft']);
    return $views;
}

One caveat of this method is that just after "quick editing" the post status, the word Draft appears...

3
  • interesting, will defs work on this and get back to you. am also lookin into the gettext filter with a conditional for the post type. will post what i end up doing once i've sorted it out. thanks @brasofilo
    – Ana Ban
    Jun 15, 2012 at 3:32
  • that is, if those "Draft" strings are passed on to gettext..
    – Ana Ban
    Jun 15, 2012 at 3:38
  • this is actually working mighty fine fo'me! no such caveat on wp3.4. thanks much you epic you... lol! just had to insert 'Drafts' in there, see my question edit. :D
    – Ana Ban
    Jun 27, 2012 at 8:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.