How to change Portfolio’s slug from portfolio_item to something else.

Hi everyone,

As we have received a few requests for a tutorial on changing the default theme’s portfolio_item slug we are willing to show the whole process in a step by step guide.
In the example below we shall change the “portfolio” Custom Post Type to “book” just for the sake of this tutorial.

1. We make a copy of the plugin file found in \wp-content\plugins\fortuna_portfolio_cpt\fortuna_portfolio_cpt.php – this is the plugin responsible for registering the Portfolio custom post type. We shall name it and place it in a directory according to its new name “book” so: \wp-content\plugins\fortuna_book_cpt\fortuna_book_cpt.php

2. We edit the newly created fortuna_book_cpt.php file and replace all occurrences of “portfolio” with “book”. At this point in order to finalize the registration of our new “Book” custom post type we should go to WP Dashboard and activate our “Fortuna Book CPT” plugin and deactivate the “Fortuna Portfolio CPT”.

3. Next we need to setup the correct templates for this newly created post type. We can copy over the portfolio templates into your Child Theme and rename them accordingly followin the new “book” nomenclature.

We’ll need:

  • single-portfolio.php -> single-book.php
  • taxonomy-portfolio_category.php -> taxonomy-book_category.php
  • portfolio-three-column.php -> book-three-column.php

4. If you will be using the portfolio-three-column.php (the Template with the category filter dropdown) you will need to update inside of it the call to the “boc_get_portfolio_items” method, replace it with “boc_get_book_items” then edit your Child theme’s function.php file and add this new method:

if( ! function_exists( ‘boc_get_book_items’ ) ) {
function boc_get_book_items($limit = 10, $order_by = ‘rand’, $order = ‘DESC’, $category=”, $paged = 1) {

$args = array(
‘ignore_sticky_posts’ => 0,
‘post_type’ => ‘book’,
‘posts_per_page’ => (int)$limit,
‘orderby’=> $order_by,
‘order’=> $order,
‘paged’ => $paged,
‘portfolio_category’ => $category,

$query = new WP_Query($args);


return $query;



Posted in Uncategorized | Leave a comment

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>