Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I'm developing a site for a client and am using the blog part of WordPress for her portfolio. I've also created a couple of page templates to list here workshops and current projects and used Custom Post Types to enable her to add content to these pages. It now looks strange to have her portfolio to be labelled as posts and I wondered whether this is easy to change without messing with the functionality of the website.

I want the navigation within the Wp backend to read:

Portfolio

Workshops

Current Proejcts

and then all the other links underneath.

share|improve this question
add comment

8 Answers

If you want to simply rename the appearance of posts, rather than creating a custom post type then add this code to your themes functions.php file.

// hook the translation filters
add_filter(  'gettext',  'change_post_to_portfolio'  );
add_filter(  'ngettext',  'change_post_to_portfolio'  );

function change_post_to_portfolio( $translated ) {
  $translated = str_ireplace(  'Post',  'Portfolio',  $translated );  // ireplace is PHP5 only
  return $translated;
}

In the interests of transparency I got this code from this article, although I have used similar tricks in the past.

share|improve this answer
    
While this is fine as display of technical concept, replacing some word in all localized text is overly broad. –  Rarst Nov 18 '12 at 15:15
add comment

You need to create a Custom Post Type, "Portfolio".

Posts are Posts. Why try to use them as something they're not, and then try to change their nomenclature, instead of writing one or two simple functions in functions.php, that will result in having both the exact functionality and the exact nomenclature that you want?

share|improve this answer
    
Because I've not used custom post types until today and the website I set up uses the blog feature to run a portfolio as the client doesn't want a blog - so I thought why not use the blog set up to run a portfolio instead - save reinventing the wheel so to speak. It seems a lot easier to change the manu names than re-do the entire site as all the content has been added. –  Evie Milo Apr 28 '11 at 15:12
    
It would just take a SQL query to change the post_type for all impacted Posts, once you have created your Custom Post Type... –  Chip Bennett Apr 28 '11 at 15:14
    
For an expert like yourself maybe - not a novice like me. –  Evie Milo Apr 28 '11 at 15:23
1  
Chip's definitely correct here. This is what I would do and what should be done in a case like this IMHO. –  mfields May 13 '11 at 0:36
2  
The sql you need looks a bit like this UPDATE wp_posts SET post_type = 'funny-bunny' WHERE post_type = 'post'; You will most likely need to change the table prefix (wp_) to reflect that setting in your current installation. –  mfields May 13 '11 at 0:39
show 1 more comment

I used the following script to rename the default post type:

function change_post_menu_label() {
global $menu;
global $submenu;
$menu[5][0] = 'Portfolio';
$submenu['edit.php'][5][0] = 'Portfolio';
$submenu['edit.php'][10][0] = 'New Portfolio';
$submenu['edit.php'][16][0] = 'Portfolio Tags';
echo '';
}
function change_post_object_label() {
global $wp_post_types;
$labels = &$wp_post_types['post']->labels;
$labels->name = 'Portfolio';
$labels->singular_name = 'Portfolio';
$labels->add_new = 'New Portfolio';
$labels->add_new_item = 'New Portfolio';
$labels->edit_item = 'Edit Portfolio';
$labels->new_item = 'New Portfolio';
$labels->view_item = 'View Portfolio';
$labels->search_items = 'Search Portfolio';
$labels->not_found = 'Not found';
$labels->not_found_in_trash = 'Not found in trash';
 }
add_action( 'init', 'change_post_object_label' );
add_action( 'admin_menu', 'change_post_menu_label' );
share|improve this answer
add comment

this plugin changes post types: http://wordpress.org/extend/plugins/post-type-switcher/

i think this one works more in bulk http://wordpress.org/extend/plugins/convert-post-types/

share|improve this answer
add comment
// hook the translation filters
add_filter(  'gettext',  'change_post_to_article'  );
add_filter(  'ngettext',  'change_post_to_article'  );

function change_post_to_article( $translated ) {
     $translated = str_ireplace(  'Post',  'Article',  $translated );  // ireplace is PHP5 only
     return $translated;
}

I got this tip from smashing magazine and tested it and it works great

http://www.smashingmagazine.com/2011/05/10/new-wordpress-power-tips-for-template-developers-and-consultants/
share|improve this answer
add comment

I found this thread when I was looking for a solution to change the post type from one name to an other.

Instead of doing a custom query as suggested by someone in here I simply did this:

$post = get_post( $id );      // The current post id
$post->post_type = 'receipt'; // The new post type name
wp_update_post( $post );      // Updating the new information

The cpt have to ofc already have been created and formated..

share|improve this answer
add comment

If you just want to change the admin menu label from Post -> Portfolio, then look at this question:

Changing Admin Menu Labels

[Update]

This plugin Admin Menu Editor looks like it will allow you to change menu labels more easily - I haven't tested it though.

share|improve this answer
    
thanks I'll see if I can figure something out from this, although it looks a bit complicated for me. –  Evie Milo Apr 28 '11 at 15:13
1  
I added a link to a plugin that should help you –  anu Apr 28 '11 at 15:19
    
thanks for the link, but I want to get more into the functions.php file and avoid using too many plugins. I followed your first link and it eventually led me here: new2wp.com/snippet/change-wordpress-posts-post-type-news and that has helped me sort it out really quickly - thanks for your help! –  Evie Milo Apr 28 '11 at 15:24
    
@Evie Milo - you should mark the answer as accepted. –  kaiser Apr 28 '11 at 23:54
add comment

You will just need to create another custom post with the same capabilities as a regular post. You can then disable the Posts menu with this:

function remove_menus()
{
    global $menu;
    $restricted = array( __('Posts'));
    end ($menu);

    while (prev($menu))
    {
        $value = explode(' ',$menu[key($menu)][0]);

        if(in_array($value[0] != NULL?$value[0]:"" , $restricted))
        {
            unset($menu[key($menu)]);
        }
    }
}
add_action('admin_menu', 'remove_menus');
share|improve this answer
    
going down this route would create too much additional work at this late stage in the project - not something the budget would allow - all content has now been added and I just wanted to see if there was a way to rename the posts to portfolio so it was less confusing for the client. –  Evie Milo Apr 28 '11 at 15:15
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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