Special Offer: Get All 151 Premium WordPress Themes for Just $99.99 $59.99 Purchase Now Learn more

tGymm: How to Change Class Slug Name

tGymm: How to Change Class Slug Name

If you use our tGymm Theme, you probably use the Class built-in custom post type. In some cases, you may need to rename it to something else. In such case, it will require some code changes. Here are all of the necessary steps:

1.Login to your Admin Panel

2. Navigate to Left Menu -> Appearance -> Theme Editor

3. Open functions.php

4. Rename the following occurrences of ‘class’ to ‘your_new_name’:

if ($postType == 'class' || $postType == 'teammember') {
register_post_type( 'class', $args );
$data = get_post_meta($post->ID, 'class', true);
if ( 'class' != get_post_type( $post_id ) )
update_post_meta( $post_id, 'class', $data );
add_meta_box( 'class_metabox', 'Class Information', 'tishonator_add_class_fields', 'class' );
if ($post_type == 'class') {

5. The same rename of ‘class’ needs to be applied in file inc/blocks.php

$classesArgs = array( 'post_type' => 'class', 'posts_per_page' => 10 );
$data = get_post_meta( $r->post->ID, 'class', true );

6. And the same rename of ‘class’ needs to be applied in file inc/widgets.php

$classesArgs = array( 'post_type' 		=> 'class',
$data = get_post_meta( $r->post->ID, 'class', true );

7. And the same rename of ‘class’ needs to be applied in file single-class.php

$data = get_post_meta( get_the_ID(), 'class', true );

8. Also, you need to connect via FTP to your site /public_html/yoursite/wp-content/themes/tgymm and rename file: single-class.php to your single-yournewname.php

Please Note: After the above change, all of the existing Classes in Admin Panel -> Left Menu -> Classes will disappear and they needs to be recreated again.