Knowledge Base

How can I change my URL structure

NOTICE: This guide is for older themes, read this on how to change the custom post type slug on Ignition Framework based themes.

Our themes come with Custom Post Types, for example, Portfolios, Galleries, etc. Each custom post type has a “slug”, or to put it simply: a friendly name for URLs and people to read.

As a default rule, we name each slug under the English version of the Custom Post Type. So for example, your URL for a Portfolio post would be something like http://www.yourdomain.com/portfolio/portfolio-name.

If you wish to alter the name of your post type (for example, if you want instead of “portfolio” to say “work”) follow the guide below:

1. Open the respective file under functions/post_types/. The php file you are looking for in most cases has the same name as its CPT, so for Portfolios, it would be functions/post_types/portfolio.php.

TIP: These files are not accessible through the built-in WordPress editor. You will either need to use the WPIDE plugin or FTP to your server and use your preferred code editor to make the changes listed below.

2. Find the piece of code:

$args = array(
'labels' => $labels,
'singular_label' => __('Portfolio', 'ci_theme'),
'public' => true,
'show_ui' => true,
'capability_type' => 'post',
'hierarchical' => false,
'has_archive' => false,
'rewrite' => true,
'menu_position' => 5,
'supports' => array('title', 'editor', 'thumbnail', 'excerpt', 'comments')
);

Notice this line:

'rewrite' => true,

Convert it as follows:

'rewrite' => array( 'slug' => 'work' ),

Notice that “work” should be the word that you wish.

UPDATE

On our newer themes the line you are looking for will be something like the one below

rewrite'         => array( 'slug' => _x( 'room', 'post type slug', 'ci_theme' ) ),

in this case, you can just modify the

'room'

bit with the word you want to see.

Hit save, upload and then go to Settings → Permalinks in order for your permalinks to be regenerated.

That’s all :)